From: Christian Grothoff Date: Mon, 14 May 2012 19:15:04 +0000 (+0000) Subject: -fix use after free on shutdown X-Git-Tag: initial-import-from-subversion-38251~13493 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b633941315e126aed01437fb56bcc8dfb64908b1;p=oweals%2Fgnunet.git -fix use after free on shutdown --- diff --git a/src/transport/test_transport_api_restart_1peer.c b/src/transport/test_transport_api_restart_1peer.c index b414805d8..d01d9e432 100644 --- a/src/transport/test_transport_api_restart_1peer.c +++ b/src/transport/test_transport_api_restart_1peer.c @@ -112,7 +112,9 @@ end () th = NULL; GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); + p1 = NULL; GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); + p2 = NULL; } static void @@ -338,11 +340,13 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) { struct PeerContext *p = cls; - if (0 == memcmp (peer, &p1->id, sizeof (struct GNUNET_PeerIdentity))) + if ( (NULL != p1) && + (0 == memcmp (peer, &p1->id, sizeof (struct GNUNET_PeerIdentity)))) { p1_connected = GNUNET_NO; } - if (0 == memcmp (peer, &p2->id, sizeof (struct GNUNET_PeerIdentity))) + if ( (NULL != p2) && + (0 == memcmp (peer, &p2->id, sizeof (struct GNUNET_PeerIdentity)))) { p2_connected = GNUNET_NO; }