aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-12-20 18:20:01 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-12-20 18:20:01 +0000
commit1fafb67104a747d2b8ad723bfed23cdcc6a08d3c (patch)
treeab7d0a02f07009a599e194c661a0c5776fb3c7fc /src
parentd984072da3e10cd711cf63791767083dd65e3c29 (diff)
downloadgnunet-1fafb67104a747d2b8ad723bfed23cdcc6a08d3c.tar.gz
gnunet-1fafb67104a747d2b8ad723bfed23cdcc6a08d3c.zip
- fix free after call to continuation
Diffstat (limited to 'src')
-rw-r--r--src/gns/gns_api.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 95c2d54b3..b75755e25 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -365,6 +365,8 @@ process_lookup_reply (struct GNUNET_GNS_LookupRequest *qe,
365{ 365{
366 struct GNUNET_GNS_Handle *handle = qe->gns_handle; 366 struct GNUNET_GNS_Handle *handle = qe->gns_handle;
367 struct PendingMessage *p = (struct PendingMessage *) &qe[1]; 367 struct PendingMessage *p = (struct PendingMessage *) &qe[1];
368 GNUNET_GNS_LookupResultProcessor proc;
369 void *proc_cls;
368 uint32_t rd_count = ntohl (msg->rd_count); 370 uint32_t rd_count = ntohl (msg->rd_count);
369 struct GNUNET_GNSRECORD_Data rd[rd_count]; 371 struct GNUNET_GNSRECORD_Data rd[rd_count];
370 size_t mlen; 372 size_t mlen;
@@ -378,6 +380,10 @@ process_lookup_reply (struct GNUNET_GNS_LookupRequest *qe,
378 } 380 }
379 mlen = ntohs (msg->header.size); 381 mlen = ntohs (msg->header.size);
380 mlen -= sizeof (struct GNUNET_GNS_ClientLookupResultMessage); 382 mlen -= sizeof (struct GNUNET_GNS_ClientLookupResultMessage);
383 proc = qe->lookup_proc;
384 proc_cls = qe->proc_cls;
385 GNUNET_CONTAINER_DLL_remove (handle->lookup_head, handle->lookup_tail, qe);
386 GNUNET_free (qe);
381 if (GNUNET_SYSERR == GNUNET_GNSRECORD_records_deserialize (mlen, 387 if (GNUNET_SYSERR == GNUNET_GNSRECORD_records_deserialize (mlen,
382 (const char*) &msg[1], 388 (const char*) &msg[1],
383 rd_count, 389 rd_count,
@@ -385,17 +391,15 @@ process_lookup_reply (struct GNUNET_GNS_LookupRequest *qe,
385 { 391 {
386 LOG (GNUNET_ERROR_TYPE_ERROR, 392 LOG (GNUNET_ERROR_TYPE_ERROR,
387 _("Failed to serialize lookup reply from GNS service!\n")); 393 _("Failed to serialize lookup reply from GNS service!\n"));
388 qe->lookup_proc (qe->proc_cls, 0, NULL); 394 proc (proc_cls, 0, NULL);
389 } 395 }
390 else 396 else
391 { 397 {
392 LOG (GNUNET_ERROR_TYPE_DEBUG, 398 LOG (GNUNET_ERROR_TYPE_DEBUG,
393 "Received lookup reply from GNS service (%u records)\n", 399 "Received lookup reply from GNS service (%u records)\n",
394 (unsigned int) rd_count); 400 (unsigned int) rd_count);
395 qe->lookup_proc (qe->proc_cls, rd_count, rd); 401 proc (proc_cls, rd_count, rd);
396 } 402 }
397 GNUNET_CONTAINER_DLL_remove (handle->lookup_head, handle->lookup_tail, qe);
398 GNUNET_free (qe);
399} 403}
400 404
401 405