- fix memleak on error (cov 10812)
authorBart Polot <bart@net.in.tum.de>
Fri, 15 Nov 2013 13:00:43 +0000 (13:00 +0000)
committerBart Polot <bart@net.in.tum.de>
Fri, 15 Nov 2013 13:00:43 +0000 (13:00 +0000)
src/mesh/gnunet-service-mesh_connection.c

index c4712f3f2ab6b0ca4844ba0ab8479e7e9930a133..2749a7d097a0efd717e54c90e128c8a92da1df1a 100644 (file)
@@ -1227,7 +1227,10 @@ GMC_handle_create (void *cls, const struct GNUNET_PeerIdentity *peer,
         LOG (GNUNET_ERROR_TYPE_DEBUG, "  Creating connection\n");
     c = GMC_new (cid, NULL, path_duplicate (path), own_pos);
     if (NULL == c)
+    {
+      path_destroy (path);
       return GNUNET_OK;
+    }
     connection_reset_timeout (c, GNUNET_YES);
   }
   else
@@ -2087,6 +2090,7 @@ GMC_new (const struct GNUNET_HashCode *cid,
   {
     GNUNET_break (0);
     GMC_destroy (c);
+    path_destroy (p);
     return NULL;
   }
   c->own_pos = own_pos;