diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-19 22:01:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-19 22:01:50 +0000 |
commit | 5a03634851a77f29e4dffb8d80b094be226687b0 (patch) | |
tree | ded1de79df67b98b90c7f74097cb522f34ad9761 /src/multicast | |
parent | bbdd32ba7bb61fe29790ad9d0d05918c5ef08208 (diff) | |
download | gnunet-5a03634851a77f29e4dffb8d80b094be226687b0.tar.gz gnunet-5a03634851a77f29e4dffb8d80b094be226687b0.zip |
-fix leak
Diffstat (limited to 'src/multicast')
-rw-r--r-- | src/multicast/multicast_api.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/multicast/multicast_api.c b/src/multicast/multicast_api.c index aa15edccf..cda451eb8 100644 --- a/src/multicast/multicast_api.c +++ b/src/multicast/multicast_api.c | |||
@@ -223,23 +223,30 @@ group_recv_join_request (void *cls, | |||
223 | struct GNUNET_CLIENT_MANAGER_Connection *client, | 223 | struct GNUNET_CLIENT_MANAGER_Connection *client, |
224 | const struct GNUNET_MessageHeader *msg) | 224 | const struct GNUNET_MessageHeader *msg) |
225 | { | 225 | { |
226 | struct GNUNET_MULTICAST_Group * | 226 | struct GNUNET_MULTICAST_Group *grp; |
227 | grp = GNUNET_CLIENT_MANAGER_get_user_context_ (client, sizeof (*grp)); | 227 | const struct MulticastJoinRequestMessage *jreq; |
228 | 228 | struct GNUNET_MULTICAST_JoinHandle *jh; | |
229 | const struct MulticastJoinRequestMessage * | 229 | const struct GNUNET_MessageHeader *jmsg; |
230 | jreq = (const struct MulticastJoinRequestMessage *) msg; | ||
231 | 230 | ||
232 | struct GNUNET_MULTICAST_JoinHandle *jh = GNUNET_malloc (sizeof (*jh)); | 231 | grp = GNUNET_CLIENT_MANAGER_get_user_context_ (client, sizeof (*grp)); |
232 | if (NULL == grp) | ||
233 | { | ||
234 | GNUNET_break (0); | ||
235 | return; | ||
236 | } | ||
237 | if (NULL == grp->join_req_cb) | ||
238 | return; | ||
239 | /* FIXME: this fails to check that 'msg' is well-formed! */ | ||
240 | jreq = (const struct MulticastJoinRequestMessage *) msg; | ||
241 | if (sizeof (*jreq) + sizeof (*jmsg) <= ntohs (jreq->header.size)) | ||
242 | jmsg = (const struct GNUNET_MessageHeader *) &jreq[1]; | ||
243 | else | ||
244 | jmsg = NULL; | ||
245 | jh = GNUNET_malloc (sizeof (*jh)); | ||
233 | jh->group = grp; | 246 | jh->group = grp; |
234 | jh->member_key = jreq->member_key; | 247 | jh->member_key = jreq->member_key; |
235 | jh->peer = jreq->peer; | 248 | jh->peer = jreq->peer; |
236 | 249 | grp->join_req_cb (grp->cb_cls, &jreq->member_key, jmsg, jh); | |
237 | const struct GNUNET_MessageHeader *jmsg = NULL; | ||
238 | if (sizeof (*jreq) + sizeof (*jmsg) <= ntohs (jreq->header.size)) | ||
239 | jmsg = (const struct GNUNET_MessageHeader *) &jreq[1]; | ||
240 | |||
241 | if (NULL != grp->join_req_cb) | ||
242 | grp->join_req_cb (grp->cb_cls, &jreq->member_key, jmsg, jh); | ||
243 | } | 250 | } |
244 | 251 | ||
245 | 252 | ||