fixing leak
authorChristian Grothoff <christian@grothoff.org>
Thu, 28 Apr 2011 20:26:18 +0000 (20:26 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 28 Apr 2011 20:26:18 +0000 (20:26 +0000)
src/fs/gnunet-service-fs_lc.c

index 15dd4897ac36aa4130b865f672b6d31481d51088..11b26c452e020bf33f2d6ec6d87fa24f80f5332d 100644 (file)
@@ -263,13 +263,17 @@ client_response_handler (void *cls,
   GNUNET_assert (pr == cr->pr);
   lc = cr->lc;
   msize = sizeof (struct PutMessage) + data_len;
-  pm = GNUNET_malloc (msize);
-  pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT);
-  pm->header.size = htons (msize);
-  pm->type = htonl (type);
-  pm->expiration = GNUNET_TIME_absolute_hton (expiration);
-  memcpy (&pm[1], data, data_len);      
-  GSF_local_client_transmit_ (lc, &pm->header);
+  {
+    char buf[msize];
+    
+    pm = (struct PutMessage*) buf;
+    pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT);
+    pm->header.size = htons (msize);
+    pm->type = htonl (type);
+    pm->expiration = GNUNET_TIME_absolute_hton (expiration);
+    memcpy (&pm[1], data, data_len);      
+    GSF_local_client_transmit_ (lc, &pm->header);
+  }
 #if DEBUG_FS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Queued reply to query `%s' for local client\n",