diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-26 09:16:26 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-26 09:16:26 +0000 |
commit | ac923b9393651fa65c79ee1e4d3fc5cc870373f5 (patch) | |
tree | d1d95ea66d8042490ddc405cef203f8bc64bd61f | |
parent | 0c032f0c5102f06b6ac79a04cde02289aa77478a (diff) | |
download | gnunet-ac923b9393651fa65c79ee1e4d3fc5cc870373f5.tar.gz gnunet-ac923b9393651fa65c79ee1e4d3fc5cc870373f5.zip |
additional check to prevent double free
-rw-r--r-- | src/ats/test_ats_api_performance_monitor.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ats/test_ats_api_performance_monitor.c b/src/ats/test_ats_api_performance_monitor.c index facb97917..d13f8b80c 100644 --- a/src/ats/test_ats_api_performance_monitor.c +++ b/src/ats/test_ats_api_performance_monitor.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "ats.h" | 29 | #include "ats.h" |
30 | 30 | ||
31 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) | 31 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) |
32 | #define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) | ||
32 | 33 | ||
33 | static GNUNET_SCHEDULER_TaskIdentifier die_task; | 34 | static GNUNET_SCHEDULER_TaskIdentifier die_task; |
34 | 35 | ||
@@ -104,6 +105,7 @@ ats_perf_cb (void *cls, | |||
104 | { | 105 | { |
105 | static int peer0 = GNUNET_NO; | 106 | static int peer0 = GNUNET_NO; |
106 | static int peer1 = GNUNET_NO; | 107 | static int peer1 = GNUNET_NO; |
108 | static int done = GNUNET_NO; | ||
107 | if ((GNUNET_NO == peer0) && (0 == memcmp (address, &p[0].id, sizeof (p[0].id)))) | 109 | if ((GNUNET_NO == peer0) && (0 == memcmp (address, &p[0].id, sizeof (p[0].id)))) |
108 | { | 110 | { |
109 | peer0 = GNUNET_YES; | 111 | peer0 = GNUNET_YES; |
@@ -112,11 +114,13 @@ ats_perf_cb (void *cls, | |||
112 | { | 114 | { |
113 | peer1 = GNUNET_YES; | 115 | peer1 = GNUNET_YES; |
114 | } | 116 | } |
115 | if ((peer0 == GNUNET_YES) && (peer1 = GNUNET_YES)) | 117 | if ((peer0 == GNUNET_YES) && (peer1 = GNUNET_YES) && (GNUNET_NO == done)) |
116 | { | 118 | { |
117 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 119 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
118 | "Done\n"); | 120 | "Done\n"); |
121 | done = GNUNET_YES; | ||
119 | GNUNET_SCHEDULER_add_now (&end, NULL); | 122 | GNUNET_SCHEDULER_add_now (&end, NULL); |
123 | |||
120 | } | 124 | } |
121 | } | 125 | } |
122 | 126 | ||
@@ -199,8 +203,6 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
199 | ret = 0; | 203 | ret = 0; |
200 | } | 204 | } |
201 | 205 | ||
202 | |||
203 | |||
204 | static void | 206 | static void |
205 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, | 207 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, |
206 | struct GNUNET_TESTING_Peer *peer) | 208 | struct GNUNET_TESTING_Peer *peer) |
@@ -216,6 +218,7 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, | |||
216 | GNUNET_SCHEDULER_add_now (end_badly, NULL); | 218 | GNUNET_SCHEDULER_add_now (end_badly, NULL); |
217 | } | 219 | } |
218 | 220 | ||
221 | |||
219 | stats = GNUNET_STATISTICS_create ("ats", cfg); | 222 | stats = GNUNET_STATISTICS_create ("ats", cfg); |
220 | GNUNET_STATISTICS_watch (stats, "ats", "# addresses", &stat_cb, NULL); | 223 | GNUNET_STATISTICS_watch (stats, "ats", "# addresses", &stat_cb, NULL); |
221 | 224 | ||