diff options
author | Linus Nordberg <linus@nordu.net> | 2011-02-04 13:59:19 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2011-02-04 13:59:19 +0100 |
commit | 3bc1fa7833f021604074aaa7a53cdca34be34d5f (patch) | |
tree | 552f9ce652df82ea5d3a3d609992dde619157a28 /lib | |
parent | 397c523a8c21e35f2e0370977a8da1598dde42b4 (diff) |
Initialize pointer in example program before trusting it.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/examples/client-blocking.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/examples/client-blocking.c b/lib/examples/client-blocking.c index 21d40d8..def0068 100644 --- a/lib/examples/client-blocking.c +++ b/lib/examples/client-blocking.c @@ -18,7 +18,7 @@ blocking_client (const char *av1, const char *av2, int use_request_object_flag) { struct rs_context *h; struct rs_connection *conn; - struct rs_packet *req, *resp; + struct rs_packet *req, *resp = NULL; if (rs_context_create (&h, "/usr/share/freeradius/dictionary")) return NULL; @@ -76,12 +76,13 @@ blocking_client (const char *av1, const char *av2, int use_request_object_flag) if (resp) { - RADIUS_PACKET *fr_pkt; - VALUE_PAIR *fr_vp; + RADIUS_PACKET *fr_pkt = NULL; + VALUE_PAIR *fr_vp = NULL; fr_pkt = rs_packet_frpkt (resp); - fr_vp = fr_pkt->vps; /* FIXME: Is there an accessor? */ - vp_printlist(stdout, fr_vp); + fr_vp = fr_pkt->vps; /* FIXME: Is there an accessor? */ + if (fr_vp) + vp_printlist(stdout, fr_vp); rs_packet_destroy (resp); } |