- merge with master
[oweals/gnunet.git] / src / gns / gns_api.c
index 26293f4df836a161665e3842d8ce8f57e55ca4d1..84c4ae189f3ee760450062b39309285fbfc67be4 100644 (file)
@@ -244,10 +244,7 @@ handle_result (void *cls,
     return;
   proc = lr->lookup_proc;
   proc_cls = lr->proc_cls;
-  GNUNET_CONTAINER_DLL_remove (handle->lookup_head,
-                               handle->lookup_tail,
-                               lr);
-  GNUNET_free (lr);
+  
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_GNSRECORD_records_deserialize (mlen,
                                                        (const char*) &lookup_msg[1],
@@ -256,6 +253,12 @@ handle_result (void *cls,
   proc (proc_cls,
         rd_count,
         rd);
+  GNUNET_CONTAINER_DLL_remove (handle->lookup_head,
+                               handle->lookup_tail,
+                               lr);
+  if (NULL != lr->env)
+    GNUNET_MQ_discard (lr->env);
+  GNUNET_free (lr);
 }