Remove superflous heap allocation
authorDavid Barksdale <amatus.amongus@gmail.com>
Sat, 20 Dec 2014 17:02:44 +0000 (17:02 +0000)
committerDavid Barksdale <amatus.amongus@gmail.com>
Sat, 20 Dec 2014 17:02:44 +0000 (17:02 +0000)
src/peerstore/gnunet-service-peerstore.c

index 3f54eed85abb695634ab669c8d4ee57197ba56d8..8af15140004c284d89fbe748817be76fefa38321 100644 (file)
@@ -250,15 +250,12 @@ record_iterator (void *cls, const struct GNUNET_PEERSTORE_Record *record,
   if (NULL == record)
   {
     /* No more records */
-    struct GNUNET_MessageHeader *endmsg;
+    struct GNUNET_MessageHeader endmsg;
 
-    endmsg = GNUNET_new (struct GNUNET_MessageHeader);
-
-    endmsg->size = htons (sizeof (struct GNUNET_MessageHeader));
-    endmsg->type = htons (GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE_END);
-    GNUNET_SERVER_notification_context_unicast (nc, cls_record->client, endmsg,
+    endmsg.size = htons (sizeof (struct GNUNET_MessageHeader));
+    endmsg.type = htons (GNUNET_MESSAGE_TYPE_PEERSTORE_ITERATE_END);
+    GNUNET_SERVER_notification_context_unicast (nc, cls_record->client, &endmsg,
                                                 GNUNET_NO);
-    GNUNET_free (endmsg);
     GNUNET_SERVER_receive_done (cls_record->client,
                                 NULL == emsg ? GNUNET_OK : GNUNET_SYSERR);
     PEERSTORE_destroy_record (cls_record);