gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r9834 - GNUnet/src/applications/dv/module


From: gnunet
Subject: [GNUnet-SVN] r9834 - GNUnet/src/applications/dv/module
Date: Mon, 21 Dec 2009 11:58:54 +0100

Author: grothoff
Date: 2009-12-21 11:58:54 +0100 (Mon, 21 Dec 2009)
New Revision: 9834

Modified:
   GNUnet/src/applications/dv/module/dv.c
Log:
fixing double-free

Modified: GNUnet/src/applications/dv/module/dv.c
===================================================================
--- GNUnet/src/applications/dv/module/dv.c      2009-12-21 10:48:36 UTC (rev 
9833)
+++ GNUnet/src/applications/dv/module/dv.c      2009-12-21 10:58:54 UTC (rev 
9834)
@@ -1028,14 +1028,14 @@
            (char *) &encNeighbor);
 #endif
 
-  if (((memcmp (neighbor->neighbor, toMatch, sizeof (GNUNET_PeerIdentity)) ==
-        0) && (neighbor->referrer == NULL)) || ((neighbor->referrer != NULL)
-                                                &&
-                                                (memcmp
-                                                 (neighbor->referrer, toMatch,
-                                                  sizeof
-                                                  (GNUNET_PeerIdentity)) ==
-                                                 0)))
+  if ( ( (neighbor->referrer == NULL) &&
+        (0 == memcmp (neighbor->neighbor, 
+                      toMatch, 
+                      sizeof (GNUNET_PeerIdentity))) ) ||
+       ( (neighbor->referrer != NULL) &&
+        (0 == memcmp (neighbor->referrer, toMatch,
+                      sizeof
+                      (GNUNET_PeerIdentity))) ) )
     {
       /* FIXME: we might want to have some way to notify the rest of
          our DV-neigborhood about this disconnect as well... */
@@ -1088,11 +1088,7 @@
                                             &peer->hashPubKey);
           GNUNET_CONTAINER_heap_iterate (ctx->neighbor_max_heap,
                                          &delete_callback, (void *) peer);
-          /* Note that we do not use delete_neighbor here because
-             we are deleting from the direct neighbor list! */
-          GNUNET_free (neighbor->neighbor);
-          GNUNET_free_non_null (neighbor->referrer);
-          GNUNET_free (neighbor);
+         /* delete_callback will free 'neighbour' (and members) */
         }
     }
   GNUNET_mutex_unlock (ctx->dvMutex);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]