aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api_restart_1peer.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-05-14 19:15:04 +0000
committerChristian Grothoff <christian@grothoff.org>2012-05-14 19:15:04 +0000
commitb633941315e126aed01437fb56bcc8dfb64908b1 (patch)
tree9b959b054542ff71d789765e2626d9bdd31e39bd /src/transport/test_transport_api_restart_1peer.c
parent3ca09986cc13363f43f578102ea7dfbb409d31ce (diff)
downloadgnunet-b633941315e126aed01437fb56bcc8dfb64908b1.tar.gz
gnunet-b633941315e126aed01437fb56bcc8dfb64908b1.zip
-fix use after free on shutdown
Diffstat (limited to 'src/transport/test_transport_api_restart_1peer.c')
-rw-r--r--src/transport/test_transport_api_restart_1peer.c8
1 files changed, 6 insertions, 2 deletions
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 ()
112 th = NULL; 112 th = NULL;
113 113
114 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1); 114 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p1);
115 p1 = NULL;
115 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); 116 GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2);
117 p2 = NULL;
116} 118}
117 119
118static void 120static void
@@ -338,11 +340,13 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
338{ 340{
339 struct PeerContext *p = cls; 341 struct PeerContext *p = cls;
340 342
341 if (0 == memcmp (peer, &p1->id, sizeof (struct GNUNET_PeerIdentity))) 343 if ( (NULL != p1) &&
344 (0 == memcmp (peer, &p1->id, sizeof (struct GNUNET_PeerIdentity))))
342 { 345 {
343 p1_connected = GNUNET_NO; 346 p1_connected = GNUNET_NO;
344 } 347 }
345 if (0 == memcmp (peer, &p2->id, sizeof (struct GNUNET_PeerIdentity))) 348 if ( (NULL != p2) &&
349 (0 == memcmp (peer, &p2->id, sizeof (struct GNUNET_PeerIdentity))))
346 { 350 {
347 p2_connected = GNUNET_NO; 351 p2_connected = GNUNET_NO;
348 } 352 }