diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-04-21 00:54:49 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-04-21 00:54:49 +0200 |
commit | 30361fe0e89a72e2dd248a93824b06d858e4e81a (patch) | |
tree | 5cd5b9917bf1fb6899587683ab1680472c29194a | |
parent | 172d6b0c471cd6512b8074d78f59ae9bb8cad9e7 (diff) | |
download | gnunet-30361fe0e89a72e2dd248a93824b06d858e4e81a.tar.gz gnunet-30361fe0e89a72e2dd248a93824b06d858e4e81a.zip |
make GNUNET_freez default, have GNUNET_free_nz for cases where that does not work
83 files changed, 155 insertions, 165 deletions
diff --git a/src/abd/gnunet-abd.c b/src/abd/gnunet-abd.c index a5d32c3dd..eb3e29e23 100644 --- a/src/abd/gnunet-abd.c +++ b/src/abd/gnunet-abd.c | |||
@@ -1074,7 +1074,7 @@ main (int argc, char *const *argv) | |||
1074 | &run, | 1074 | &run, |
1075 | NULL)) | 1075 | NULL)) |
1076 | ret = 1; | 1076 | ret = 1; |
1077 | GNUNET_free ((void *) argv); | 1077 | GNUNET_free_nz ((void *) argv); |
1078 | return ret; | 1078 | return ret; |
1079 | } | 1079 | } |
1080 | 1080 | ||
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c index 3b4e770b0..ea3a012ab 100644 --- a/src/arm/gnunet-arm.c +++ b/src/arm/gnunet-arm.c | |||
@@ -1054,10 +1054,10 @@ main (int argc, char *const *argv) | |||
1054 | &run, | 1054 | &run, |
1055 | NULL))) | 1055 | NULL))) |
1056 | { | 1056 | { |
1057 | GNUNET_free ((void *) argv); | 1057 | GNUNET_free_nz ((void *) argv); |
1058 | return ret; | 1058 | return ret; |
1059 | } | 1059 | } |
1060 | GNUNET_free ((void *) argv); | 1060 | GNUNET_free_nz ((void *) argv); |
1061 | return lret; | 1061 | return lret; |
1062 | } | 1062 | } |
1063 | 1063 | ||
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c index 16636e505..947ed7798 100644 --- a/src/ats-tool/gnunet-ats.c +++ b/src/ats-tool/gnunet-ats.c | |||
@@ -980,7 +980,7 @@ main (int argc, char *const *argv) | |||
980 | NULL); | 980 | NULL); |
981 | GNUNET_free_non_null (opt_pid_str); | 981 | GNUNET_free_non_null (opt_pid_str); |
982 | GNUNET_free_non_null (opt_type_str); | 982 | GNUNET_free_non_null (opt_type_str); |
983 | GNUNET_free ((void *) argv); | 983 | GNUNET_free_nz ((void *) argv); |
984 | 984 | ||
985 | if (GNUNET_OK == res) | 985 | if (GNUNET_OK == res) |
986 | return ret; | 986 | return ret; |
diff --git a/src/auction/gnunet-auction-create.c b/src/auction/gnunet-auction-create.c index 79106d8e8..93947b89c 100644 --- a/src/auction/gnunet-auction-create.c +++ b/src/auction/gnunet-auction-create.c | |||
@@ -214,6 +214,6 @@ main (int argc, char *const *argv) | |||
214 | options, | 214 | options, |
215 | &run, | 215 | &run, |
216 | NULL)) ? ret : 1; | 216 | NULL)) ? ret : 1; |
217 | GNUNET_free ((void *) argv); | 217 | GNUNET_free_nz ((void *) argv); |
218 | return ret; | 218 | return ret; |
219 | } | 219 | } |
diff --git a/src/auction/gnunet-auction-info.c b/src/auction/gnunet-auction-info.c index f20565835..dded45ce6 100644 --- a/src/auction/gnunet-auction-info.c +++ b/src/auction/gnunet-auction-info.c | |||
@@ -78,7 +78,7 @@ main (int argc, char *const *argv) | |||
78 | options, | 78 | options, |
79 | &run, | 79 | &run, |
80 | NULL)) ? ret : 1; | 80 | NULL)) ? ret : 1; |
81 | GNUNET_free ((void *) argv); | 81 | GNUNET_free_nz ((void *) argv); |
82 | return ret; | 82 | return ret; |
83 | } | 83 | } |
84 | 84 | ||
diff --git a/src/auction/gnunet-auction-join.c b/src/auction/gnunet-auction-join.c index f20565835..dded45ce6 100644 --- a/src/auction/gnunet-auction-join.c +++ b/src/auction/gnunet-auction-join.c | |||
@@ -78,7 +78,7 @@ main (int argc, char *const *argv) | |||
78 | options, | 78 | options, |
79 | &run, | 79 | &run, |
80 | NULL)) ? ret : 1; | 80 | NULL)) ? ret : 1; |
81 | GNUNET_free ((void *) argv); | 81 | GNUNET_free_nz ((void *) argv); |
82 | return ret; | 82 | return ret; |
83 | } | 83 | } |
84 | 84 | ||
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c index f3ccd9883..9b7538ae7 100644 --- a/src/cadet/gnunet-cadet.c +++ b/src/cadet/gnunet-cadet.c | |||
@@ -840,7 +840,7 @@ main (int argc, char *const *argv) | |||
840 | &run, | 840 | &run, |
841 | NULL); | 841 | NULL); |
842 | 842 | ||
843 | GNUNET_free ((void *) argv); | 843 | GNUNET_free_nz ((void *) argv); |
844 | 844 | ||
845 | if (GNUNET_OK == res) | 845 | if (GNUNET_OK == res) |
846 | return 0; | 846 | return 0; |
diff --git a/src/conversation/gnunet-conversation-test.c b/src/conversation/gnunet-conversation-test.c index 2e6772d92..9f8e54033 100644 --- a/src/conversation/gnunet-conversation-test.c +++ b/src/conversation/gnunet-conversation-test.c | |||
@@ -257,7 +257,7 @@ main (int argc, | |||
257 | options, | 257 | options, |
258 | &run, | 258 | &run, |
259 | NULL)) ? ret : 1; | 259 | NULL)) ? ret : 1; |
260 | GNUNET_free ((void *) argv); | 260 | GNUNET_free_nz ((void *) argv); |
261 | return ret; | 261 | return ret; |
262 | } | 262 | } |
263 | 263 | ||
diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c index 6c0a6e42f..b908cd82c 100644 --- a/src/conversation/gnunet-conversation.c +++ b/src/conversation/gnunet-conversation.c | |||
@@ -1219,7 +1219,7 @@ main (int argc, char *const *argv) | |||
1219 | options, | 1219 | options, |
1220 | &run, | 1220 | &run, |
1221 | NULL); | 1221 | NULL); |
1222 | GNUNET_free ((void *) argv); | 1222 | GNUNET_free_nz ((void *) argv); |
1223 | if (NULL != cfg) | 1223 | if (NULL != cfg) |
1224 | { | 1224 | { |
1225 | GNUNET_CONFIGURATION_destroy (cfg); | 1225 | GNUNET_CONFIGURATION_destroy (cfg); |
diff --git a/src/core/gnunet-core.c b/src/core/gnunet-core.c index 90777a7a8..d90c8e1f5 100644 --- a/src/core/gnunet-core.c +++ b/src/core/gnunet-core.c | |||
@@ -198,7 +198,7 @@ main (int argc, char *const *argv) | |||
198 | &run, | 198 | &run, |
199 | NULL); | 199 | NULL); |
200 | 200 | ||
201 | GNUNET_free ((void *) argv); | 201 | GNUNET_free_nz ((void *) argv); |
202 | if (GNUNET_OK == res) | 202 | if (GNUNET_OK == res) |
203 | return 0; | 203 | return 0; |
204 | return 1; | 204 | return 1; |
diff --git a/src/datastore/gnunet-datastore.c b/src/datastore/gnunet-datastore.c index 54d087bc4..5901cce54 100644 --- a/src/datastore/gnunet-datastore.c +++ b/src/datastore/gnunet-datastore.c | |||
@@ -500,7 +500,7 @@ main (int argc, char *const *argv) | |||
500 | &run, | 500 | &run, |
501 | NULL)) | 501 | NULL)) |
502 | ret = 1; | 502 | ret = 1; |
503 | GNUNET_free ((void *) argv); | 503 | GNUNET_free_nz ((void *) argv); |
504 | return ret; | 504 | return ret; |
505 | } | 505 | } |
506 | 506 | ||
diff --git a/src/dns/gnunet-dns-monitor.c b/src/dns/gnunet-dns-monitor.c index 7be792fc5..f6c0d0660 100644 --- a/src/dns/gnunet-dns-monitor.c +++ b/src/dns/gnunet-dns-monitor.c | |||
@@ -387,7 +387,7 @@ main (int argc, char *const *argv) | |||
387 | gettext_noop | 387 | gettext_noop |
388 | ("Monitor DNS queries."), options, | 388 | ("Monitor DNS queries."), options, |
389 | &run, NULL)) ? ret : 1; | 389 | &run, NULL)) ? ret : 1; |
390 | GNUNET_free ((void *) argv); | 390 | GNUNET_free_nz ((void *) argv); |
391 | return ret; | 391 | return ret; |
392 | } | 392 | } |
393 | 393 | ||
diff --git a/src/dns/gnunet-dns-redirector.c b/src/dns/gnunet-dns-redirector.c index f7051f70b..606864c8a 100644 --- a/src/dns/gnunet-dns-redirector.c +++ b/src/dns/gnunet-dns-redirector.c | |||
@@ -260,7 +260,7 @@ main (int argc, char *const *argv) | |||
260 | ("Change DNS replies to point elsewhere."), | 260 | ("Change DNS replies to point elsewhere."), |
261 | options, | 261 | options, |
262 | &run, NULL)) ? ret : 1; | 262 | &run, NULL)) ? ret : 1; |
263 | GNUNET_free ((void *) argv); | 263 | GNUNET_free_nz ((void *) argv); |
264 | return ret; | 264 | return ret; |
265 | } | 265 | } |
266 | 266 | ||
diff --git a/src/fs/gnunet-auto-share.c b/src/fs/gnunet-auto-share.c index 53c64ab04..13bc908e8 100644 --- a/src/fs/gnunet-auto-share.c +++ b/src/fs/gnunet-auto-share.c | |||
@@ -775,7 +775,7 @@ main (int argc, char *const *argv) | |||
775 | sigpipe = NULL; | 775 | sigpipe = NULL; |
776 | GNUNET_free_non_null (cfg_filename); | 776 | GNUNET_free_non_null (cfg_filename); |
777 | cfg_filename = NULL; | 777 | cfg_filename = NULL; |
778 | GNUNET_free ((void *) argv); | 778 | GNUNET_free_nz ((void *) argv); |
779 | return ok; | 779 | return ok; |
780 | } | 780 | } |
781 | 781 | ||
diff --git a/src/fs/gnunet-directory.c b/src/fs/gnunet-directory.c index 58950bceb..10a09f73b 100644 --- a/src/fs/gnunet-directory.c +++ b/src/fs/gnunet-directory.c | |||
@@ -203,7 +203,7 @@ main (int argc, char *const *argv) | |||
203 | NULL)) | 203 | NULL)) |
204 | ? ret | 204 | ? ret |
205 | : 1; | 205 | : 1; |
206 | GNUNET_free ((void *) argv); | 206 | GNUNET_free_nz ((void *) argv); |
207 | return ret; | 207 | return ret; |
208 | } | 208 | } |
209 | 209 | ||
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c index 63bb02958..eebf8e993 100644 --- a/src/fs/gnunet-download.c +++ b/src/fs/gnunet-download.c | |||
@@ -376,7 +376,7 @@ main (int argc, char *const *argv) | |||
376 | NULL)) | 376 | NULL)) |
377 | ? ret | 377 | ? ret |
378 | : 1; | 378 | : 1; |
379 | GNUNET_free ((void *) argv); | 379 | GNUNET_free_nz ((void *) argv); |
380 | return ret; | 380 | return ret; |
381 | } | 381 | } |
382 | 382 | ||
diff --git a/src/fs/gnunet-fs-profiler.c b/src/fs/gnunet-fs-profiler.c index fe86cf21f..62da46834 100644 --- a/src/fs/gnunet-fs-profiler.c +++ b/src/fs/gnunet-fs-profiler.c | |||
@@ -237,7 +237,7 @@ main (int argc, char *const *argv) | |||
237 | "run a testbed to measure file-sharing performance"), | 237 | "run a testbed to measure file-sharing performance"), |
238 | options, &run, | 238 | options, &run, |
239 | NULL)) ? ret : 1; | 239 | NULL)) ? ret : 1; |
240 | GNUNET_free ((void *) argv); | 240 | GNUNET_free_nz ((void *) argv); |
241 | return ret; | 241 | return ret; |
242 | } | 242 | } |
243 | 243 | ||
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c index 35d410d37..70a0034a0 100644 --- a/src/fs/gnunet-fs.c +++ b/src/fs/gnunet-fs.c | |||
@@ -144,7 +144,7 @@ main (int argc, char *const *argv) | |||
144 | NULL)) | 144 | NULL)) |
145 | ? ret | 145 | ? ret |
146 | : 1; | 146 | : 1; |
147 | GNUNET_free ((void *) argv); | 147 | GNUNET_free_nz ((void *) argv); |
148 | return ret; | 148 | return ret; |
149 | } | 149 | } |
150 | 150 | ||
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index ac310b785..b10e6163c 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c | |||
@@ -992,7 +992,7 @@ main (int argc, char *const *argv) | |||
992 | NULL)) | 992 | NULL)) |
993 | ? ret | 993 | ? ret |
994 | : 1; | 994 | : 1; |
995 | GNUNET_free ((void *) argv); | 995 | GNUNET_free_nz ((void *) argv); |
996 | return ret; | 996 | return ret; |
997 | } | 997 | } |
998 | 998 | ||
diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c index e0b9a31fd..098633379 100644 --- a/src/fs/gnunet-search.c +++ b/src/fs/gnunet-search.c | |||
@@ -371,7 +371,7 @@ main (int argc, char *const *argv) | |||
371 | NULL)) | 371 | NULL)) |
372 | ? ret | 372 | ? ret |
373 | : 1; | 373 | : 1; |
374 | GNUNET_free ((void *) argv); | 374 | GNUNET_free_nz ((void *) argv); |
375 | return ret; | 375 | return ret; |
376 | } | 376 | } |
377 | 377 | ||
diff --git a/src/fs/gnunet-unindex.c b/src/fs/gnunet-unindex.c index bf32de812..afc547127 100644 --- a/src/fs/gnunet-unindex.c +++ b/src/fs/gnunet-unindex.c | |||
@@ -197,7 +197,7 @@ main (int argc, char *const *argv) | |||
197 | NULL)) | 197 | NULL)) |
198 | ? ret | 198 | ? ret |
199 | : 1; | 199 | : 1; |
200 | GNUNET_free ((void *) argv); | 200 | GNUNET_free_nz ((void *) argv); |
201 | return ret; | 201 | return ret; |
202 | } | 202 | } |
203 | 203 | ||
diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c index 6ceff4a9a..f71f477ef 100644 --- a/src/gns/gnunet-bcd.c +++ b/src/gns/gnunet-bcd.c | |||
@@ -525,7 +525,7 @@ main (int argc, char *const *argv) | |||
525 | NULL)) | 525 | NULL)) |
526 | ? 0 | 526 | ? 0 |
527 | : 1; | 527 | : 1; |
528 | GNUNET_free ((void *) argv); | 528 | GNUNET_free_nz ((void *) argv); |
529 | return ret; | 529 | return ret; |
530 | } | 530 | } |
531 | 531 | ||
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c index 8ec1f1cdb..eb9996b36 100644 --- a/src/gns/gnunet-dns2gns.c +++ b/src/gns/gnunet-dns2gns.c | |||
@@ -775,7 +775,7 @@ main (int argc, | |||
775 | _ ("GNUnet DNS-to-GNS proxy (a DNS server)"), | 775 | _ ("GNUnet DNS-to-GNS proxy (a DNS server)"), |
776 | options, | 776 | options, |
777 | &run, NULL)) ? 0 : 1; | 777 | &run, NULL)) ? 0 : 1; |
778 | GNUNET_free ((void *) argv); | 778 | GNUNET_free_nz ((void *) argv); |
779 | return ret; | 779 | return ret; |
780 | } | 780 | } |
781 | 781 | ||
diff --git a/src/gns/gnunet-gns-benchmark.c b/src/gns/gnunet-gns-benchmark.c index 0dcff7566..b36a83f21 100644 --- a/src/gns/gnunet-gns-benchmark.c +++ b/src/gns/gnunet-gns-benchmark.c | |||
@@ -610,7 +610,7 @@ main (int argc, | |||
610 | &run, | 610 | &run, |
611 | NULL)) | 611 | NULL)) |
612 | ret = 1; | 612 | ret = 1; |
613 | GNUNET_free ((void *) argv); | 613 | GNUNET_free_nz ((void *) argv); |
614 | return ret; | 614 | return ret; |
615 | } | 615 | } |
616 | 616 | ||
diff --git a/src/gns/gnunet-gns-import.c b/src/gns/gnunet-gns-import.c index 0c104ee0d..2c7c56411 100644 --- a/src/gns/gnunet-gns-import.c +++ b/src/gns/gnunet-gns-import.c | |||
@@ -486,7 +486,7 @@ main (int argc, char *const *argv) | |||
486 | "This program will import some GNS authorities into your GNS namestore."), | 486 | "This program will import some GNS authorities into your GNS namestore."), |
487 | options, | 487 | options, |
488 | &run, NULL); | 488 | &run, NULL); |
489 | GNUNET_free ((void *) argv); | 489 | GNUNET_free_nz ((void *) argv); |
490 | return GNUNET_OK == r ? ret : 1; | 490 | return GNUNET_OK == r ? ret : 1; |
491 | } | 491 | } |
492 | 492 | ||
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index d52761ef8..eb1d4f23f 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c | |||
@@ -376,7 +376,7 @@ main (int argc, char *const *argv) | |||
376 | options, | 376 | options, |
377 | &run, | 377 | &run, |
378 | NULL); | 378 | NULL); |
379 | GNUNET_free ((void *) argv); | 379 | GNUNET_free_nz ((void *) argv); |
380 | if (GNUNET_OK != ret) | 380 | if (GNUNET_OK != ret) |
381 | return 1; | 381 | return 1; |
382 | return global_ret; | 382 | return global_ret; |
diff --git a/src/gnsrecord/perf_gnsrecord_crypto.c b/src/gnsrecord/perf_gnsrecord_crypto.c index b2614eb77..eb4633f75 100644 --- a/src/gnsrecord/perf_gnsrecord_crypto.c +++ b/src/gnsrecord/perf_gnsrecord_crypto.c | |||
@@ -107,7 +107,7 @@ run (void *cls, | |||
107 | GNUNET_YES), | 107 | GNUNET_YES), |
108 | ROUNDS); | 108 | ROUNDS); |
109 | for (unsigned int i = 0; i < RECORDS; i++) | 109 | for (unsigned int i = 0; i < RECORDS; i++) |
110 | GNUNET_free ((void *) s_rd[i].data); | 110 | GNUNET_free_nz ((void *) s_rd[i].data); |
111 | GNUNET_free (s_rd); | 111 | GNUNET_free (s_rd); |
112 | } | 112 | } |
113 | 113 | ||
diff --git a/src/gnsrecord/test_gnsrecord_serialization.c b/src/gnsrecord/test_gnsrecord_serialization.c index 22d9f8396..d268cb7f3 100644 --- a/src/gnsrecord/test_gnsrecord_serialization.c +++ b/src/gnsrecord/test_gnsrecord_serialization.c | |||
@@ -132,7 +132,7 @@ run (void *cls, | |||
132 | 132 | ||
133 | for (c = 0; c < rd_count; c++) | 133 | for (c = 0; c < rd_count; c++) |
134 | { | 134 | { |
135 | GNUNET_free ((void *) src[c].data); | 135 | GNUNET_free_nz ((void *) src[c].data); |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index ca77545cd..704c796b4 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c | |||
@@ -409,7 +409,7 @@ main (int argc, char *const *argv) | |||
409 | _ ("GNUnet hostlist server and client"), | 409 | _ ("GNUnet hostlist server and client"), |
410 | options, | 410 | options, |
411 | &run, NULL)) ? 0 : 1; | 411 | &run, NULL)) ? 0 : 1; |
412 | GNUNET_free ((void *) argv); | 412 | GNUNET_free_nz ((void *) argv); |
413 | return ret; | 413 | return ret; |
414 | } | 414 | } |
415 | 415 | ||
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c index 1350376d9..8445a0ee5 100644 --- a/src/identity/gnunet-identity.c +++ b/src/identity/gnunet-identity.c | |||
@@ -439,7 +439,7 @@ main (int argc, char *const *argv) | |||
439 | options, | 439 | options, |
440 | &run, | 440 | &run, |
441 | NULL); | 441 | NULL); |
442 | GNUNET_free ((void *) argv); | 442 | GNUNET_free_nz ((void *) argv); |
443 | 443 | ||
444 | if (GNUNET_OK != res) | 444 | if (GNUNET_OK != res) |
445 | return 3; | 445 | return 3; |
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 78aeb3de7..9e7c77786 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -1284,23 +1284,23 @@ GNUNET_is_zero_ (const void *a, | |||
1284 | * @ingroup memory | 1284 | * @ingroup memory |
1285 | * Wrapper around free. Frees the memory referred to by ptr. | 1285 | * Wrapper around free. Frees the memory referred to by ptr. |
1286 | * Note that it is generally better to free memory that was | 1286 | * Note that it is generally better to free memory that was |
1287 | * allocated with #GNUNET_array_grow using #GNUNET_array_grow(mem, size, 0) instead of #GNUNET_free. | 1287 | * allocated with #GNUNET_array_grow using #GNUNET_array_grow(mem, size, 0) instead of #GNUNET_free_nz. |
1288 | * | 1288 | * |
1289 | * @param ptr location where to free the memory. ptr must have | 1289 | * @param ptr location where to free the memory. ptr must have |
1290 | * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier. | 1290 | * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier. |
1291 | */ | 1291 | */ |
1292 | #define GNUNET_free(ptr) GNUNET_xfree_ (ptr, __FILE__, __LINE__) | 1292 | #define GNUNET_free_nz(ptr) GNUNET_xfree_ (ptr, __FILE__, __LINE__) |
1293 | 1293 | ||
1294 | /** | 1294 | /** |
1295 | * @ingroup memory | 1295 | * @ingroup memory |
1296 | * Wrapper around free. Frees the memory referred to by ptr and sets ptr to NULL. | 1296 | * Wrapper around free. Frees the memory referred to by ptr and sets ptr to NULL. |
1297 | * Note that it is generally better to free memory that was | 1297 | * Note that it is generally better to free memory that was |
1298 | * allocated with #GNUNET_array_grow using #GNUNET_array_grow(mem, size, 0) instead of #GNUNET_freez. | 1298 | * allocated with #GNUNET_array_grow using #GNUNET_array_grow(mem, size, 0) instead of #GNUNET_free. |
1299 | * | 1299 | * |
1300 | * @param ptr location where to free the memory. ptr must have | 1300 | * @param ptr location where to free the memory. ptr must have |
1301 | * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier. | 1301 | * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier. |
1302 | */ | 1302 | */ |
1303 | #define GNUNET_freez(ptr) do { \ | 1303 | #define GNUNET_free(ptr) do { \ |
1304 | GNUNET_xfree_ (ptr, __FILE__, __LINE__); \ | 1304 | GNUNET_xfree_ (ptr, __FILE__, __LINE__); \ |
1305 | ptr = NULL; \ | 1305 | ptr = NULL; \ |
1306 | } while (0) | 1306 | } while (0) |
diff --git a/src/json/Makefile.am b/src/json/Makefile.am index 5968a3596..9cd80851c 100644 --- a/src/json/Makefile.am +++ b/src/json/Makefile.am | |||
@@ -37,6 +37,7 @@ TESTS = \ | |||
37 | 37 | ||
38 | test_json_SOURCES = \ | 38 | test_json_SOURCES = \ |
39 | test_json.c | 39 | test_json.c |
40 | test_json_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) | ||
40 | test_json_LDADD = \ | 41 | test_json_LDADD = \ |
41 | libgnunetjson.la \ | 42 | libgnunetjson.la \ |
42 | $(top_builddir)/src/util/libgnunetutil.la \ | 43 | $(top_builddir)/src/util/libgnunetutil.la \ |
diff --git a/src/json/json_gnsrecord.c b/src/json/json_gnsrecord.c index bfbdd96ee..37f0c03da 100644 --- a/src/json/json_gnsrecord.c +++ b/src/json/json_gnsrecord.c | |||
@@ -50,10 +50,10 @@ cleanup_recordinfo (struct GnsRecordInfo *gnsrecord_info) | |||
50 | { | 50 | { |
51 | if (NULL != *(gnsrecord_info->rd)) | 51 | if (NULL != *(gnsrecord_info->rd)) |
52 | { | 52 | { |
53 | for (int i = 0; i < *(gnsrecord_info->rd_count); i++) | 53 | for (unsigned int i = 0; i < *(gnsrecord_info->rd_count); i++) |
54 | { | 54 | { |
55 | if (NULL != (*(gnsrecord_info->rd))[i].data) | 55 | if (NULL != (*(gnsrecord_info->rd))[i].data) |
56 | GNUNET_free ((char *) (*(gnsrecord_info->rd))[i].data); | 56 | GNUNET_free_nz ((char *) (*(gnsrecord_info->rd))[i].data); |
57 | } | 57 | } |
58 | GNUNET_free (*(gnsrecord_info->rd)); | 58 | GNUNET_free (*(gnsrecord_info->rd)); |
59 | *(gnsrecord_info->rd) = NULL; | 59 | *(gnsrecord_info->rd) = NULL; |
diff --git a/src/json/test_json_mhd.c b/src/json/test_json_mhd.c index 5ab1b63ca..642715f25 100644 --- a/src/json/test_json_mhd.c +++ b/src/json/test_json_mhd.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_json_lib.h" | 28 | #include "gnunet_json_lib.h" |
29 | #include "gnunet_curl_lib.h" | 29 | #include "gnunet_curl_lib.h" |
30 | #include "gnunet_mhd_compat.h" | ||
30 | #include <zlib.h> | 31 | #include <zlib.h> |
31 | 32 | ||
32 | #define MAX_SIZE 1024 * 1024 | 33 | #define MAX_SIZE 1024 * 1024 |
@@ -36,7 +37,7 @@ static json_t *bigj; | |||
36 | static int global_ret; | 37 | static int global_ret; |
37 | 38 | ||
38 | 39 | ||
39 | static int | 40 | static MHD_RESULT |
40 | access_handler_cb (void *cls, | 41 | access_handler_cb (void *cls, |
41 | struct MHD_Connection *connection, | 42 | struct MHD_Connection *connection, |
42 | const char *url, | 43 | const char *url, |
diff --git a/src/namecache/gnunet-namecache.c b/src/namecache/gnunet-namecache.c index 15a0c96ee..2e3c733e6 100644 --- a/src/namecache/gnunet-namecache.c +++ b/src/namecache/gnunet-namecache.c | |||
@@ -235,10 +235,10 @@ main (int argc, char *const *argv) | |||
235 | &run, | 235 | &run, |
236 | NULL)) | 236 | NULL)) |
237 | { | 237 | { |
238 | GNUNET_free ((void *) argv); | 238 | GNUNET_free_nz ((void *) argv); |
239 | return 1; | 239 | return 1; |
240 | } | 240 | } |
241 | GNUNET_free ((void *) argv); | 241 | GNUNET_free_nz ((void *) argv); |
242 | return ret; | 242 | return ret; |
243 | } | 243 | } |
244 | 244 | ||
diff --git a/src/namecache/test_namecache_api_cache_block.c b/src/namecache/test_namecache_api_cache_block.c index 9b150c9d9..12b72d93b 100644 --- a/src/namecache/test_namecache_api_cache_block.c +++ b/src/namecache/test_namecache_api_cache_block.c | |||
@@ -39,7 +39,7 @@ static struct GNUNET_NAMECACHE_Handle *nsh; | |||
39 | 39 | ||
40 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 40 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
41 | 41 | ||
42 | static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | 42 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; |
43 | 43 | ||
44 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 44 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; |
45 | 45 | ||
@@ -56,11 +56,6 @@ cleanup () | |||
56 | GNUNET_NAMECACHE_disconnect (nsh); | 56 | GNUNET_NAMECACHE_disconnect (nsh); |
57 | nsh = NULL; | 57 | nsh = NULL; |
58 | } | 58 | } |
59 | if (NULL != privkey) | ||
60 | { | ||
61 | GNUNET_free (privkey); | ||
62 | privkey = NULL; | ||
63 | } | ||
64 | GNUNET_SCHEDULER_shutdown (); | 59 | GNUNET_SCHEDULER_shutdown (); |
65 | } | 60 | } |
66 | 61 | ||
@@ -188,10 +183,12 @@ run (void *cls, | |||
188 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); | 183 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); |
189 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", | 184 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", |
190 | hostkey_file); | 185 | hostkey_file); |
191 | privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); | 186 | GNUNET_assert (GNUNET_SYSERR != |
187 | GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file, | ||
188 | GNUNET_YES, | ||
189 | &privkey)); | ||
192 | GNUNET_free (hostkey_file); | 190 | GNUNET_free (hostkey_file); |
193 | GNUNET_assert (privkey != NULL); | 191 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, &pubkey); |
194 | GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); | ||
195 | 192 | ||
196 | 193 | ||
197 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 10000000000; | 194 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 10000000000; |
@@ -200,7 +197,7 @@ run (void *cls, | |||
200 | rd.data = GNUNET_malloc (TEST_RECORD_DATALEN); | 197 | rd.data = GNUNET_malloc (TEST_RECORD_DATALEN); |
201 | rd.flags = 0; | 198 | rd.flags = 0; |
202 | memset ((char *) rd.data, 'a', TEST_RECORD_DATALEN); | 199 | memset ((char *) rd.data, 'a', TEST_RECORD_DATALEN); |
203 | block = GNUNET_GNSRECORD_block_create (privkey, | 200 | block = GNUNET_GNSRECORD_block_create (&privkey, |
204 | GNUNET_TIME_UNIT_FOREVER_ABS, | 201 | GNUNET_TIME_UNIT_FOREVER_ABS, |
205 | name, &rd, 1); | 202 | name, &rd, 1); |
206 | if (NULL == block) | 203 | if (NULL == block) |
@@ -232,7 +229,7 @@ run (void *cls, | |||
232 | _ ("Namecache cannot cache no block\n")); | 229 | _ ("Namecache cannot cache no block\n")); |
233 | } | 230 | } |
234 | GNUNET_free (block); | 231 | GNUNET_free (block); |
235 | GNUNET_free ((void *) rd.data); | 232 | GNUNET_free_nz ((void *) rd.data); |
236 | } | 233 | } |
237 | 234 | ||
238 | 235 | ||
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c index 67fc5bdf4..34641d22e 100644 --- a/src/namestore/gnunet-namestore-fcfsd.c +++ b/src/namestore/gnunet-namestore-fcfsd.c | |||
@@ -1210,7 +1210,7 @@ main (int argc, | |||
1210 | "GNU Name System First Come First Serve name registration service"), | 1210 | "GNU Name System First Come First Serve name registration service"), |
1211 | options, | 1211 | options, |
1212 | &run, NULL)) ? 0 : 1; | 1212 | &run, NULL)) ? 0 : 1; |
1213 | GNUNET_free ((void *) argv); | 1213 | GNUNET_free_nz ((void *) argv); |
1214 | GNUNET_CRYPTO_ecdsa_key_clear (&fcfs_zone_pkey); | 1214 | GNUNET_CRYPTO_ecdsa_key_clear (&fcfs_zone_pkey); |
1215 | return ret; | 1215 | return ret; |
1216 | } | 1216 | } |
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index 25dfda59b..508566a49 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c | |||
@@ -1688,11 +1688,11 @@ main (int argc, char *const *argv) | |||
1688 | &run, | 1688 | &run, |
1689 | NULL))) | 1689 | NULL))) |
1690 | { | 1690 | { |
1691 | GNUNET_free ((void *) argv); | 1691 | GNUNET_free_nz ((void *) argv); |
1692 | GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); | 1692 | GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); |
1693 | return lret; | 1693 | return lret; |
1694 | } | 1694 | } |
1695 | GNUNET_free ((void *) argv); | 1695 | GNUNET_free_nz ((void *) argv); |
1696 | GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); | 1696 | GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); |
1697 | return ret; | 1697 | return ret; |
1698 | } | 1698 | } |
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c index eca02bdc3..5b4e41475 100644 --- a/src/namestore/gnunet-zoneimport.c +++ b/src/namestore/gnunet-zoneimport.c | |||
@@ -1866,7 +1866,7 @@ main (int argc, char *const *argv) | |||
1866 | &run, | 1866 | &run, |
1867 | NULL))) | 1867 | NULL))) |
1868 | return ret; | 1868 | return ret; |
1869 | GNUNET_free ((void *) argv); | 1869 | GNUNET_free_nz ((void *) argv); |
1870 | fprintf (stderr, | 1870 | fprintf (stderr, |
1871 | "Rejected %u names, had %u cached, did %u lookups, stored %u record sets\n" | 1871 | "Rejected %u names, had %u cached, did %u lookups, stored %u record sets\n" |
1872 | "Found %u records, %u lookups failed, %u/%u pending on shutdown\n", | 1872 | "Found %u records, %u lookups failed, %u/%u pending on shutdown\n", |
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index d2a93a286..c0bf4b048 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c | |||
@@ -267,7 +267,7 @@ cleanup_handle (void *cls) | |||
267 | for (int i = 0; i < handle->rd_count; i++) | 267 | for (int i = 0; i < handle->rd_count; i++) |
268 | { | 268 | { |
269 | if (NULL != handle->rd[i].data) | 269 | if (NULL != handle->rd[i].data) |
270 | GNUNET_free ((void *) handle->rd[i].data); | 270 | GNUNET_free_nz ((void *) handle->rd[i].data); |
271 | } | 271 | } |
272 | GNUNET_free (handle->rd); | 272 | GNUNET_free (handle->rd); |
273 | } | 273 | } |
diff --git a/src/namestore/test_namestore_api_lookup_private.c b/src/namestore/test_namestore_api_lookup_private.c index 98fdb1b43..d0ad726cc 100644 --- a/src/namestore/test_namestore_api_lookup_private.c +++ b/src/namestore/test_namestore_api_lookup_private.c | |||
@@ -212,7 +212,7 @@ run (void *cls, | |||
212 | _ ("Namestore cannot store no block\n")); | 212 | _ ("Namestore cannot store no block\n")); |
213 | } | 213 | } |
214 | 214 | ||
215 | GNUNET_free ((void *) rd.data); | 215 | GNUNET_free_nz ((void *) rd.data); |
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c index 83a5a78f6..039c7cbf6 100644 --- a/src/namestore/test_namestore_api_lookup_public.c +++ b/src/namestore/test_namestore_api_lookup_public.c | |||
@@ -221,7 +221,7 @@ run (void *cls, | |||
221 | _ ("Namestore cannot store no block\n")); | 221 | _ ("Namestore cannot store no block\n")); |
222 | } | 222 | } |
223 | 223 | ||
224 | GNUNET_free ((void *) rd.data); | 224 | GNUNET_free_nz ((void *) rd.data); |
225 | } | 225 | } |
226 | 226 | ||
227 | 227 | ||
diff --git a/src/namestore/test_namestore_api_lookup_shadow.c b/src/namestore/test_namestore_api_lookup_shadow.c index 08c428731..d399d903a 100644 --- a/src/namestore/test_namestore_api_lookup_shadow.c +++ b/src/namestore/test_namestore_api_lookup_shadow.c | |||
@@ -254,7 +254,7 @@ run (void *cls, | |||
254 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 254 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
255 | _ ("Namestore cannot store no block\n")); | 255 | _ ("Namestore cannot store no block\n")); |
256 | } | 256 | } |
257 | GNUNET_free ((void *) rd.data); | 257 | GNUNET_free_nz ((void *) rd.data); |
258 | } | 258 | } |
259 | 259 | ||
260 | 260 | ||
diff --git a/src/namestore/test_namestore_api_lookup_shadow_filter.c b/src/namestore/test_namestore_api_lookup_shadow_filter.c index 634a6a3c4..40dbeb90f 100644 --- a/src/namestore/test_namestore_api_lookup_shadow_filter.c +++ b/src/namestore/test_namestore_api_lookup_shadow_filter.c | |||
@@ -336,8 +336,8 @@ run (void *cls, | |||
336 | _ ("Namestore cannot store no block\n")); | 336 | _ ("Namestore cannot store no block\n")); |
337 | } | 337 | } |
338 | 338 | ||
339 | GNUNET_free ((void *) records[0].data); | 339 | GNUNET_free_nz ((void *) records[0].data); |
340 | GNUNET_free ((void *) records[1].data); | 340 | GNUNET_free_nz ((void *) records[1].data); |
341 | } | 341 | } |
342 | 342 | ||
343 | 343 | ||
diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c index d26492517..cc00adf44 100644 --- a/src/namestore/test_namestore_api_monitoring.c +++ b/src/namestore/test_namestore_api_monitoring.c | |||
@@ -94,17 +94,17 @@ do_shutdown () | |||
94 | 94 | ||
95 | if (s_rd_1 != NULL) | 95 | if (s_rd_1 != NULL) |
96 | { | 96 | { |
97 | GNUNET_free ((void *) s_rd_1->data); | 97 | GNUNET_free_nz ((void *) s_rd_1->data); |
98 | GNUNET_free (s_rd_1); | 98 | GNUNET_free (s_rd_1); |
99 | } | 99 | } |
100 | if (s_rd_2 != NULL) | 100 | if (s_rd_2 != NULL) |
101 | { | 101 | { |
102 | GNUNET_free ((void *) s_rd_2->data); | 102 | GNUNET_free_nz ((void *) s_rd_2->data); |
103 | GNUNET_free (s_rd_2); | 103 | GNUNET_free (s_rd_2); |
104 | } | 104 | } |
105 | if (s_rd_3 != NULL) | 105 | if (s_rd_3 != NULL) |
106 | { | 106 | { |
107 | GNUNET_free ((void *) s_rd_3->data); | 107 | GNUNET_free_nz ((void *) s_rd_3->data); |
108 | GNUNET_free (s_rd_3); | 108 | GNUNET_free (s_rd_3); |
109 | } | 109 | } |
110 | } | 110 | } |
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c index 040a63f91..728fcc25e 100644 --- a/src/namestore/test_namestore_api_monitoring_existing.c +++ b/src/namestore/test_namestore_api_monitoring_existing.c | |||
@@ -111,17 +111,17 @@ end (void *cls) | |||
111 | } | 111 | } |
112 | if (NULL != s_rd_1) | 112 | if (NULL != s_rd_1) |
113 | { | 113 | { |
114 | GNUNET_free ((void *) s_rd_1->data); | 114 | GNUNET_free_nz ((void *) s_rd_1->data); |
115 | GNUNET_free (s_rd_1); | 115 | GNUNET_free (s_rd_1); |
116 | } | 116 | } |
117 | if (NULL != s_rd_2) | 117 | if (NULL != s_rd_2) |
118 | { | 118 | { |
119 | GNUNET_free ((void *) s_rd_2->data); | 119 | GNUNET_free_nz ((void *) s_rd_2->data); |
120 | GNUNET_free (s_rd_2); | 120 | GNUNET_free (s_rd_2); |
121 | } | 121 | } |
122 | if (NULL != s_rd_3) | 122 | if (NULL != s_rd_3) |
123 | { | 123 | { |
124 | GNUNET_free ((void *) s_rd_3->data); | 124 | GNUNET_free_nz ((void *) s_rd_3->data); |
125 | GNUNET_free (s_rd_3); | 125 | GNUNET_free (s_rd_3); |
126 | } | 126 | } |
127 | } | 127 | } |
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 3f0c4c123..e575821e8 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -187,7 +187,7 @@ run (void *cls, | |||
187 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 187 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
188 | _ ("Namestore cannot store no block\n")); | 188 | _ ("Namestore cannot store no block\n")); |
189 | } | 189 | } |
190 | GNUNET_free ((void *) rd.data); | 190 | GNUNET_free_nz ((void *) rd.data); |
191 | } | 191 | } |
192 | 192 | ||
193 | 193 | ||
diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c index ab211aeae..9223b56a3 100644 --- a/src/namestore/test_namestore_api_store.c +++ b/src/namestore/test_namestore_api_store.c | |||
@@ -138,7 +138,7 @@ run (void *cls, | |||
138 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 138 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
139 | _ ("Namestore cannot store no block\n")); | 139 | _ ("Namestore cannot store no block\n")); |
140 | } | 140 | } |
141 | GNUNET_free ((void *) rd.data); | 141 | GNUNET_free_nz ((void *) rd.data); |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c index 65dbdbd8c..7a5a69a6c 100644 --- a/src/namestore/test_namestore_api_store_update.c +++ b/src/namestore/test_namestore_api_store_update.c | |||
@@ -274,7 +274,7 @@ run (void *cls, | |||
274 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 274 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
275 | _ ("Namestore cannot store no block\n")); | 275 | _ ("Namestore cannot store no block\n")); |
276 | } | 276 | } |
277 | GNUNET_free ((void *) rd.data); | 277 | GNUNET_free_nz ((void *) rd.data); |
278 | } | 278 | } |
279 | 279 | ||
280 | 280 | ||
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c index d69b7cc62..a363ee28d 100644 --- a/src/namestore/test_namestore_api_zone_iteration.c +++ b/src/namestore/test_namestore_api_zone_iteration.c | |||
@@ -37,9 +37,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; | |||
37 | 37 | ||
38 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 38 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
39 | 39 | ||
40 | static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | 40 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; |
41 | 41 | ||
42 | static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey2; | 42 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; |
43 | 43 | ||
44 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; | 44 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; |
45 | 45 | ||
@@ -88,32 +88,22 @@ end (void *cls) | |||
88 | GNUNET_SCHEDULER_cancel (endbadly_task); | 88 | GNUNET_SCHEDULER_cancel (endbadly_task); |
89 | endbadly_task = NULL; | 89 | endbadly_task = NULL; |
90 | } | 90 | } |
91 | if (NULL != privkey) | ||
92 | { | ||
93 | GNUNET_free (privkey); | ||
94 | privkey = NULL; | ||
95 | } | ||
96 | if (NULL != privkey2) | ||
97 | { | ||
98 | GNUNET_free (privkey2); | ||
99 | privkey2 = NULL; | ||
100 | } | ||
101 | GNUNET_free_non_null (s_name_1); | 91 | GNUNET_free_non_null (s_name_1); |
102 | GNUNET_free_non_null (s_name_2); | 92 | GNUNET_free_non_null (s_name_2); |
103 | GNUNET_free_non_null (s_name_3); | 93 | GNUNET_free_non_null (s_name_3); |
104 | if (NULL != s_rd_1) | 94 | if (NULL != s_rd_1) |
105 | { | 95 | { |
106 | GNUNET_free ((void *) s_rd_1->data); | 96 | GNUNET_free_nz ((void *) s_rd_1->data); |
107 | GNUNET_free (s_rd_1); | 97 | GNUNET_free (s_rd_1); |
108 | } | 98 | } |
109 | if (NULL != s_rd_2) | 99 | if (NULL != s_rd_2) |
110 | { | 100 | { |
111 | GNUNET_free ((void *) s_rd_2->data); | 101 | GNUNET_free_nz ((void *) s_rd_2->data); |
112 | GNUNET_free (s_rd_2); | 102 | GNUNET_free (s_rd_2); |
113 | } | 103 | } |
114 | if (NULL != s_rd_3) | 104 | if (NULL != s_rd_3) |
115 | { | 105 | { |
116 | GNUNET_free ((void *) s_rd_3->data); | 106 | GNUNET_free_nz ((void *) s_rd_3->data); |
117 | GNUNET_free (s_rd_3); | 107 | GNUNET_free (s_rd_3); |
118 | } | 108 | } |
119 | if (NULL != nsh) | 109 | if (NULL != nsh) |
@@ -161,7 +151,7 @@ zone_proc (void *cls, | |||
161 | 151 | ||
162 | GNUNET_assert (NULL != zone); | 152 | GNUNET_assert (NULL != zone); |
163 | if (0 == GNUNET_memcmp (zone, | 153 | if (0 == GNUNET_memcmp (zone, |
164 | privkey)) | 154 | &privkey)) |
165 | { | 155 | { |
166 | if (0 == strcmp (label, s_name_1)) | 156 | if (0 == strcmp (label, s_name_1)) |
167 | { | 157 | { |
@@ -207,7 +197,7 @@ zone_proc (void *cls, | |||
207 | } | 197 | } |
208 | } | 198 | } |
209 | else if (0 == GNUNET_memcmp (zone, | 199 | else if (0 == GNUNET_memcmp (zone, |
210 | privkey2)) | 200 | &privkey2)) |
211 | { | 201 | { |
212 | if (0 == strcmp (label, s_name_3)) | 202 | if (0 == strcmp (label, s_name_3)) |
213 | { | 203 | { |
@@ -382,9 +372,11 @@ empty_zone_end (void *cls) | |||
382 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 372 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
383 | "Using zonekey file `%s' \n", | 373 | "Using zonekey file `%s' \n", |
384 | hostkey_file); | 374 | hostkey_file); |
385 | privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); | 375 | GNUNET_assert (GNUNET_SYSERR != |
376 | GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file, | ||
377 | GNUNET_YES, | ||
378 | &privkey)); | ||
386 | GNUNET_free (hostkey_file); | 379 | GNUNET_free (hostkey_file); |
387 | GNUNET_assert (privkey != NULL); | ||
388 | 380 | ||
389 | GNUNET_asprintf (&hostkey_file, | 381 | GNUNET_asprintf (&hostkey_file, |
390 | "zonefiles%s%s", | 382 | "zonefiles%s%s", |
@@ -393,16 +385,18 @@ empty_zone_end (void *cls) | |||
393 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 385 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
394 | "Using zonekey file `%s' \n", | 386 | "Using zonekey file `%s' \n", |
395 | hostkey_file); | 387 | hostkey_file); |
396 | privkey2 = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); | 388 | GNUNET_assert (GNUNET_SYSERR != |
389 | GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file, | ||
390 | GNUNET_YES, | ||
391 | &privkey2)); | ||
397 | GNUNET_free (hostkey_file); | 392 | GNUNET_free (hostkey_file); |
398 | GNUNET_assert (privkey2 != NULL); | ||
399 | 393 | ||
400 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n"); | 394 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n"); |
401 | 395 | ||
402 | GNUNET_asprintf (&s_name_1, "dummy1"); | 396 | GNUNET_asprintf (&s_name_1, "dummy1"); |
403 | s_rd_1 = create_record (1); | 397 | s_rd_1 = create_record (1); |
404 | GNUNET_NAMESTORE_records_store (nsh, | 398 | GNUNET_NAMESTORE_records_store (nsh, |
405 | privkey, | 399 | &privkey, |
406 | s_name_1, | 400 | s_name_1, |
407 | 1, s_rd_1, | 401 | 1, s_rd_1, |
408 | &put_cont, | 402 | &put_cont, |
@@ -412,7 +406,7 @@ empty_zone_end (void *cls) | |||
412 | GNUNET_asprintf (&s_name_2, "dummy2"); | 406 | GNUNET_asprintf (&s_name_2, "dummy2"); |
413 | s_rd_2 = create_record (1); | 407 | s_rd_2 = create_record (1); |
414 | GNUNET_NAMESTORE_records_store (nsh, | 408 | GNUNET_NAMESTORE_records_store (nsh, |
415 | privkey, | 409 | &privkey, |
416 | s_name_2, | 410 | s_name_2, |
417 | 1, s_rd_2, | 411 | 1, s_rd_2, |
418 | &put_cont, | 412 | &put_cont, |
@@ -423,7 +417,7 @@ empty_zone_end (void *cls) | |||
423 | GNUNET_asprintf (&s_name_3, "dummy3"); | 417 | GNUNET_asprintf (&s_name_3, "dummy3"); |
424 | s_rd_3 = create_record (1); | 418 | s_rd_3 = create_record (1); |
425 | GNUNET_NAMESTORE_records_store (nsh, | 419 | GNUNET_NAMESTORE_records_store (nsh, |
426 | privkey2, | 420 | &privkey2, |
427 | s_name_3, | 421 | s_name_3, |
428 | 1, | 422 | 1, |
429 | s_rd_3, | 423 | s_rd_3, |
diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c b/src/namestore/test_namestore_api_zone_iteration_nick.c index f5ffe3899..b0c4c8211 100644 --- a/src/namestore/test_namestore_api_zone_iteration_nick.c +++ b/src/namestore/test_namestore_api_zone_iteration_nick.c | |||
@@ -87,17 +87,17 @@ end (void *cls) | |||
87 | 87 | ||
88 | if (s_rd_1 != NULL) | 88 | if (s_rd_1 != NULL) |
89 | { | 89 | { |
90 | GNUNET_free ((void *) s_rd_1->data); | 90 | GNUNET_free_nz ((void *) s_rd_1->data); |
91 | GNUNET_free (s_rd_1); | 91 | GNUNET_free (s_rd_1); |
92 | } | 92 | } |
93 | if (s_rd_2 != NULL) | 93 | if (s_rd_2 != NULL) |
94 | { | 94 | { |
95 | GNUNET_free ((void *) s_rd_2->data); | 95 | GNUNET_free_nz ((void *) s_rd_2->data); |
96 | GNUNET_free (s_rd_2); | 96 | GNUNET_free (s_rd_2); |
97 | } | 97 | } |
98 | if (s_rd_3 != NULL) | 98 | if (s_rd_3 != NULL) |
99 | { | 99 | { |
100 | GNUNET_free ((void *) s_rd_3->data); | 100 | GNUNET_free_nz ((void *) s_rd_3->data); |
101 | GNUNET_free (s_rd_3); | 101 | GNUNET_free (s_rd_3); |
102 | } | 102 | } |
103 | } | 103 | } |
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c index 97093cb71..0534da001 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c | |||
@@ -93,17 +93,17 @@ end (void *cls) | |||
93 | GNUNET_free_non_null (s_name_3); | 93 | GNUNET_free_non_null (s_name_3); |
94 | if (s_rd_1 != NULL) | 94 | if (s_rd_1 != NULL) |
95 | { | 95 | { |
96 | GNUNET_free ((void *) s_rd_1->data); | 96 | GNUNET_free_nz ((void *) s_rd_1->data); |
97 | GNUNET_free (s_rd_1); | 97 | GNUNET_free (s_rd_1); |
98 | } | 98 | } |
99 | if (s_rd_2 != NULL) | 99 | if (s_rd_2 != NULL) |
100 | { | 100 | { |
101 | GNUNET_free ((void *) s_rd_2->data); | 101 | GNUNET_free_nz ((void *) s_rd_2->data); |
102 | GNUNET_free (s_rd_2); | 102 | GNUNET_free (s_rd_2); |
103 | } | 103 | } |
104 | if (s_rd_3 != NULL) | 104 | if (s_rd_3 != NULL) |
105 | { | 105 | { |
106 | GNUNET_free ((void *) s_rd_3->data); | 106 | GNUNET_free_nz ((void *) s_rd_3->data); |
107 | GNUNET_free (s_rd_3); | 107 | GNUNET_free (s_rd_3); |
108 | } | 108 | } |
109 | if (nsh != NULL) | 109 | if (nsh != NULL) |
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c index 81fb4de7e..b71a8789c 100644 --- a/src/namestore/test_namestore_api_zone_iteration_stop.c +++ b/src/namestore/test_namestore_api_zone_iteration_stop.c | |||
@@ -34,9 +34,9 @@ | |||
34 | 34 | ||
35 | static struct GNUNET_NAMESTORE_Handle *nsh; | 35 | static struct GNUNET_NAMESTORE_Handle *nsh; |
36 | 36 | ||
37 | static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | 37 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; |
38 | 38 | ||
39 | static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey2; | 39 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; |
40 | 40 | ||
41 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; | 41 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; |
42 | 42 | ||
@@ -80,29 +80,19 @@ end (void *cls) | |||
80 | GNUNET_free_non_null (s_name_3); | 80 | GNUNET_free_non_null (s_name_3); |
81 | if (s_rd_1 != NULL) | 81 | if (s_rd_1 != NULL) |
82 | { | 82 | { |
83 | GNUNET_free ((void *) s_rd_1->data); | 83 | GNUNET_free_nz ((void *) s_rd_1->data); |
84 | GNUNET_free (s_rd_1); | 84 | GNUNET_free (s_rd_1); |
85 | } | 85 | } |
86 | if (s_rd_2 != NULL) | 86 | if (s_rd_2 != NULL) |
87 | { | 87 | { |
88 | GNUNET_free ((void *) s_rd_2->data); | 88 | GNUNET_free_nz ((void *) s_rd_2->data); |
89 | GNUNET_free (s_rd_2); | 89 | GNUNET_free (s_rd_2); |
90 | } | 90 | } |
91 | if (s_rd_3 != NULL) | 91 | if (s_rd_3 != NULL) |
92 | { | 92 | { |
93 | GNUNET_free ((void *) s_rd_3->data); | 93 | GNUNET_free_nz ((void *) s_rd_3->data); |
94 | GNUNET_free (s_rd_3); | 94 | GNUNET_free (s_rd_3); |
95 | } | 95 | } |
96 | if (privkey != NULL) | ||
97 | { | ||
98 | GNUNET_free (privkey); | ||
99 | privkey = NULL; | ||
100 | } | ||
101 | if (privkey2 != NULL) | ||
102 | { | ||
103 | GNUNET_free (privkey2); | ||
104 | privkey2 = NULL; | ||
105 | } | ||
106 | } | 96 | } |
107 | 97 | ||
108 | 98 | ||
@@ -130,7 +120,7 @@ zone_proc (void *cls, | |||
130 | int failed = GNUNET_NO; | 120 | int failed = GNUNET_NO; |
131 | 121 | ||
132 | GNUNET_assert (NULL != zone); | 122 | GNUNET_assert (NULL != zone); |
133 | if (0 == GNUNET_memcmp (zone, privkey)) | 123 | if (0 == GNUNET_memcmp (zone, &privkey)) |
134 | { | 124 | { |
135 | if (0 == strcmp (label, s_name_1)) | 125 | if (0 == strcmp (label, s_name_1)) |
136 | { | 126 | { |
@@ -175,7 +165,7 @@ zone_proc (void *cls, | |||
175 | GNUNET_break (0); | 165 | GNUNET_break (0); |
176 | } | 166 | } |
177 | } | 167 | } |
178 | else if (0 == GNUNET_memcmp (zone, privkey2)) | 168 | else if (0 == GNUNET_memcmp (zone, &privkey2)) |
179 | { | 169 | { |
180 | if (0 == strcmp (label, s_name_3)) | 170 | if (0 == strcmp (label, s_name_3)) |
181 | { | 171 | { |
@@ -368,10 +358,11 @@ empty_zone_proc_end (void *cls) | |||
368 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 358 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
369 | "Using zonekey file `%s' \n", | 359 | "Using zonekey file `%s' \n", |
370 | hostkey_file); | 360 | hostkey_file); |
371 | privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); | 361 | GNUNET_assert (GNUNET_SYSERR |
362 | != GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file, | ||
363 | GNUNET_YES, | ||
364 | &privkey)); | ||
372 | GNUNET_free (hostkey_file); | 365 | GNUNET_free (hostkey_file); |
373 | GNUNET_assert (privkey != NULL); | ||
374 | |||
375 | GNUNET_asprintf (&hostkey_file, | 366 | GNUNET_asprintf (&hostkey_file, |
376 | "zonefiles%s%s", | 367 | "zonefiles%s%s", |
377 | DIR_SEPARATOR_STR, | 368 | DIR_SEPARATOR_STR, |
@@ -379,17 +370,19 @@ empty_zone_proc_end (void *cls) | |||
379 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 370 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
380 | "Using zonekey file `%s'\n", | 371 | "Using zonekey file `%s'\n", |
381 | hostkey_file); | 372 | hostkey_file); |
382 | privkey2 = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); | 373 | GNUNET_assert (GNUNET_SYSERR != |
374 | GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file, | ||
375 | GNUNET_YES, | ||
376 | &privkey2)); | ||
383 | GNUNET_free (hostkey_file); | 377 | GNUNET_free (hostkey_file); |
384 | GNUNET_assert (privkey2 != NULL); | ||
385 | |||
386 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 378 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
387 | "Created record 1\n"); | 379 | "Created record 1\n"); |
388 | 380 | ||
389 | GNUNET_asprintf (&s_name_1, | 381 | GNUNET_asprintf (&s_name_1, |
390 | "dummy1"); | 382 | "dummy1"); |
391 | s_rd_1 = create_record (1); | 383 | s_rd_1 = create_record (1); |
392 | GNUNET_NAMESTORE_records_store (nsh, privkey, s_name_1, | 384 | GNUNET_NAMESTORE_records_store (nsh, |
385 | &privkey, s_name_1, | ||
393 | 1, s_rd_1, &put_cont, NULL); | 386 | 1, s_rd_1, &put_cont, NULL); |
394 | 387 | ||
395 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 388 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -398,7 +391,7 @@ empty_zone_proc_end (void *cls) | |||
398 | "dummy2"); | 391 | "dummy2"); |
399 | s_rd_2 = create_record (1); | 392 | s_rd_2 = create_record (1); |
400 | GNUNET_NAMESTORE_records_store (nsh, | 393 | GNUNET_NAMESTORE_records_store (nsh, |
401 | privkey, | 394 | &privkey, |
402 | s_name_2, | 395 | s_name_2, |
403 | 1, | 396 | 1, |
404 | s_rd_2, | 397 | s_rd_2, |
@@ -411,7 +404,7 @@ empty_zone_proc_end (void *cls) | |||
411 | GNUNET_asprintf (&s_name_3, "dummy3"); | 404 | GNUNET_asprintf (&s_name_3, "dummy3"); |
412 | s_rd_3 = create_record (1); | 405 | s_rd_3 = create_record (1); |
413 | GNUNET_NAMESTORE_records_store (nsh, | 406 | GNUNET_NAMESTORE_records_store (nsh, |
414 | privkey2, | 407 | &privkey2, |
415 | s_name_3, | 408 | s_name_3, |
416 | 1, | 409 | 1, |
417 | s_rd_3, | 410 | s_rd_3, |
diff --git a/src/nat-auto/gnunet-nat-auto.c b/src/nat-auto/gnunet-nat-auto.c index d40f4ef32..95a7ced9e 100644 --- a/src/nat-auto/gnunet-nat-auto.c +++ b/src/nat-auto/gnunet-nat-auto.c | |||
@@ -359,7 +359,7 @@ main (int argc, char *const argv[]) | |||
359 | { | 359 | { |
360 | global_ret = 1; | 360 | global_ret = 1; |
361 | } | 361 | } |
362 | GNUNET_free ((void *) argv); | 362 | GNUNET_free_nz ((void *) argv); |
363 | return global_ret; | 363 | return global_ret; |
364 | } | 364 | } |
365 | 365 | ||
diff --git a/src/nat/gnunet-nat.c b/src/nat/gnunet-nat.c index 857ce5093..5012d6455 100644 --- a/src/nat/gnunet-nat.c +++ b/src/nat/gnunet-nat.c | |||
@@ -468,7 +468,7 @@ main (int argc, char *const argv[]) | |||
468 | { | 468 | { |
469 | global_ret = 1; | 469 | global_ret = 1; |
470 | } | 470 | } |
471 | GNUNET_free ((void *) argv); | 471 | GNUNET_free_nz ((void *) argv); |
472 | return global_ret; | 472 | return global_ret; |
473 | } | 473 | } |
474 | 474 | ||
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c index 4d4c4de33..df6c169b5 100644 --- a/src/peerinfo-tool/gnunet-peerinfo.c +++ b/src/peerinfo-tool/gnunet-peerinfo.c | |||
@@ -855,7 +855,7 @@ main (int argc, char *const *argv) | |||
855 | NULL)) | 855 | NULL)) |
856 | ? 0 | 856 | ? 0 |
857 | : 1; | 857 | : 1; |
858 | GNUNET_free ((void *) argv); | 858 | GNUNET_free_nz ((void *) argv); |
859 | return ret; | 859 | return ret; |
860 | } | 860 | } |
861 | 861 | ||
diff --git a/src/peerinfo-tool/plugin_rest_peerinfo.c b/src/peerinfo-tool/plugin_rest_peerinfo.c index 14559a8cf..6e156569a 100644 --- a/src/peerinfo-tool/plugin_rest_peerinfo.c +++ b/src/peerinfo-tool/plugin_rest_peerinfo.c | |||
@@ -272,7 +272,7 @@ cleanup_handle (void *cls) | |||
272 | if (NULL != handle->emsg) | 272 | if (NULL != handle->emsg) |
273 | GNUNET_free (handle->emsg); | 273 | GNUNET_free (handle->emsg); |
274 | if (NULL != handle->address) | 274 | if (NULL != handle->address) |
275 | GNUNET_free ((char *) handle->address); | 275 | GNUNET_free_nz ((char *) handle->address); |
276 | if (NULL != handle->expiration_str) | 276 | if (NULL != handle->expiration_str) |
277 | GNUNET_free (handle->expiration_str); | 277 | GNUNET_free (handle->expiration_str); |
278 | if (NULL != handle->pubkey) | 278 | if (NULL != handle->pubkey) |
diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c index f8765818b..bcc913bd2 100644 --- a/src/pt/gnunet-daemon-pt.c +++ b/src/pt/gnunet-daemon-pt.c | |||
@@ -1317,7 +1317,7 @@ main (int argc, | |||
1317 | NULL)) | 1317 | NULL)) |
1318 | ? 0 | 1318 | ? 0 |
1319 | : 1; | 1319 | : 1; |
1320 | GNUNET_free ((void *) argv); | 1320 | GNUNET_free_nz ((void *) argv); |
1321 | return ret; | 1321 | return ret; |
1322 | } | 1322 | } |
1323 | 1323 | ||
diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c index 9bf497b16..69afca789 100644 --- a/src/pt/test_gns_vpn.c +++ b/src/pt/test_gns_vpn.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include "gnunet_gnsrecord_lib.h" | 45 | #include "gnunet_gnsrecord_lib.h" |
46 | #include "gnunet_gns_service.h" | 46 | #include "gnunet_gns_service.h" |
47 | #include "gnunet_testing_lib.h" | 47 | #include "gnunet_testing_lib.h" |
48 | #include "gnunet_mhd_compat.h" | ||
48 | 49 | ||
49 | #define PORT 8080 | 50 | #define PORT 8080 |
50 | #define TEST_DOMAIN "www.gnu" | 51 | #define TEST_DOMAIN "www.gnu" |
@@ -121,7 +122,7 @@ copy_buffer (void *ptr, | |||
121 | } | 122 | } |
122 | 123 | ||
123 | 124 | ||
124 | static int | 125 | static MHD_RESULT |
125 | mhd_ahc (void *cls, | 126 | mhd_ahc (void *cls, |
126 | struct MHD_Connection *connection, | 127 | struct MHD_Connection *connection, |
127 | const char *url, | 128 | const char *url, |
@@ -611,7 +612,7 @@ identity_cb (void *cls, | |||
611 | 1, &rd, | 612 | 1, &rd, |
612 | &commence_testing, | 613 | &commence_testing, |
613 | NULL); | 614 | NULL); |
614 | GNUNET_free ((void **) rd.data); | 615 | GNUNET_free_nz ((void **) rd.data); |
615 | GNUNET_free (rd_string); | 616 | GNUNET_free (rd_string); |
616 | } | 617 | } |
617 | 618 | ||
diff --git a/src/pt/test_gnunet_vpn.c b/src/pt/test_gnunet_vpn.c index 42fd52c38..cb9bb61fe 100644 --- a/src/pt/test_gnunet_vpn.c +++ b/src/pt/test_gnunet_vpn.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <microhttpd.h> | 29 | #include <microhttpd.h> |
30 | #include "gnunet_vpn_service.h" | 30 | #include "gnunet_vpn_service.h" |
31 | #include "gnunet_testing_lib.h" | 31 | #include "gnunet_testing_lib.h" |
32 | #include "gnunet_mhd_compat.h" | ||
32 | 33 | ||
33 | #define PORT 48080 | 34 | #define PORT 48080 |
34 | 35 | ||
@@ -96,7 +97,7 @@ copy_buffer (void *ptr, size_t size, size_t nmemb, void *ctx) | |||
96 | } | 97 | } |
97 | 98 | ||
98 | 99 | ||
99 | static int | 100 | static MHD_RESULT |
100 | mhd_ahc (void *cls, | 101 | mhd_ahc (void *cls, |
101 | struct MHD_Connection *connection, | 102 | struct MHD_Connection *connection, |
102 | const char *url, | 103 | const char *url, |
diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c index eda58fdd2..d94b5ae46 100644 --- a/src/regex/gnunet-daemon-regexprofiler.c +++ b/src/regex/gnunet-daemon-regexprofiler.c | |||
@@ -118,7 +118,7 @@ shutdown_task (void *cls) | |||
118 | } | 118 | } |
119 | if (NULL != reannounce_task) | 119 | if (NULL != reannounce_task) |
120 | { | 120 | { |
121 | GNUNET_free (GNUNET_SCHEDULER_cancel (reannounce_task)); | 121 | GNUNET_free_nz (GNUNET_SCHEDULER_cancel (reannounce_task)); |
122 | reannounce_task = NULL; | 122 | reannounce_task = NULL; |
123 | } | 123 | } |
124 | if (NULL != dht_handle) | 124 | if (NULL != dht_handle) |
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index f5aa2d17e..14e23b244 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c | |||
@@ -527,7 +527,7 @@ main (int argc, char *const *argv) | |||
527 | NULL)) | 527 | NULL)) |
528 | ? ret | 528 | ? ret |
529 | : 1; | 529 | : 1; |
530 | GNUNET_free ((void *) argv); | 530 | GNUNET_free_nz ((void *) argv); |
531 | return ret; | 531 | return ret; |
532 | } | 532 | } |
533 | 533 | ||
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c index 47bdbf2c1..63afde877 100644 --- a/src/statistics/gnunet-statistics.c +++ b/src/statistics/gnunet-statistics.c | |||
@@ -881,7 +881,7 @@ main (int argc, char *const *argv) | |||
881 | num_nodes, | 881 | num_nodes, |
882 | 0); | 882 | 0); |
883 | GNUNET_free_non_null (remote_host); | 883 | GNUNET_free_non_null (remote_host); |
884 | GNUNET_free ((void *) argv); | 884 | GNUNET_free_nz ((void *) argv); |
885 | return ret; | 885 | return ret; |
886 | } | 886 | } |
887 | 887 | ||
diff --git a/src/template/gnunet-template.c b/src/template/gnunet-template.c index b33cbcc64..5e250bbdf 100644 --- a/src/template/gnunet-template.c +++ b/src/template/gnunet-template.c | |||
@@ -78,7 +78,7 @@ main (int argc, char *const *argv) | |||
78 | NULL)) | 78 | NULL)) |
79 | ? ret | 79 | ? ret |
80 | : 1; | 80 | : 1; |
81 | GNUNET_free ((void *) argv); | 81 | GNUNET_free_nz ((void *) argv); |
82 | return ret; | 82 | return ret; |
83 | } | 83 | } |
84 | 84 | ||
diff --git a/src/testbed/gnunet-daemon-latency-logger.c b/src/testbed/gnunet-daemon-latency-logger.c index 0af718a63..c13750db7 100644 --- a/src/testbed/gnunet-daemon-latency-logger.c +++ b/src/testbed/gnunet-daemon-latency-logger.c | |||
@@ -317,6 +317,6 @@ main (int argc, char *const *argv) | |||
317 | _ ( | 317 | _ ( |
318 | "Daemon to log latency values of connections to neighbours"), | 318 | "Daemon to log latency values of connections to neighbours"), |
319 | options, &run, NULL)) ? 0 : 1; | 319 | options, &run, NULL)) ? 0 : 1; |
320 | GNUNET_free ((void *) argv); | 320 | GNUNET_free_nz ((void *) argv); |
321 | return ret; | 321 | return ret; |
322 | } | 322 | } |
diff --git a/src/testbed/gnunet-daemon-testbed-blacklist.c b/src/testbed/gnunet-daemon-testbed-blacklist.c index 070583941..c82f8075f 100644 --- a/src/testbed/gnunet-daemon-testbed-blacklist.c +++ b/src/testbed/gnunet-daemon-testbed-blacklist.c | |||
@@ -249,6 +249,6 @@ main (int argc, char *const *argv) | |||
249 | _ ( | 249 | _ ( |
250 | "Daemon to restrict incoming transport layer connections during testbed deployments"), | 250 | "Daemon to restrict incoming transport layer connections during testbed deployments"), |
251 | options, &run, NULL)) ? 0 : 1; | 251 | options, &run, NULL)) ? 0 : 1; |
252 | GNUNET_free ((void *) argv); | 252 | GNUNET_free_nz ((void *) argv); |
253 | return ret; | 253 | return ret; |
254 | } | 254 | } |
diff --git a/src/testbed/gnunet-daemon-testbed-underlay.c b/src/testbed/gnunet-daemon-testbed-underlay.c index 09dfee5a6..2bff7cdd4 100644 --- a/src/testbed/gnunet-daemon-testbed-underlay.c +++ b/src/testbed/gnunet-daemon-testbed-underlay.c | |||
@@ -476,6 +476,6 @@ main (int argc, char *const *argv) | |||
476 | ( | 476 | ( |
477 | "Daemon to restrict underlay network in testbed deployments"), | 477 | "Daemon to restrict underlay network in testbed deployments"), |
478 | options, &run, NULL)) ? 0 : 1; | 478 | options, &run, NULL)) ? 0 : 1; |
479 | GNUNET_free ((void *) argv); | 479 | GNUNET_free_nz ((void *) argv); |
480 | return ret; | 480 | return ret; |
481 | } | 481 | } |
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index cfc6367fe..90813c8e5 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c | |||
@@ -318,7 +318,7 @@ main (int argc, char *const *argv) | |||
318 | ret = | 318 | ret = |
319 | GNUNET_PROGRAM_run (argc, argv, "gnunet-testbed-profiler", binaryHelp, | 319 | GNUNET_PROGRAM_run (argc, argv, "gnunet-testbed-profiler", binaryHelp, |
320 | options, &run, NULL); | 320 | options, &run, NULL); |
321 | GNUNET_free ((void *) argv); | 321 | GNUNET_free_nz ((void *) argv); |
322 | if (GNUNET_OK != ret) | 322 | if (GNUNET_OK != ret) |
323 | return ret; | 323 | return ret; |
324 | if (GNUNET_OK != result) | 324 | if (GNUNET_OK != result) |
diff --git a/src/testing/gnunet-testing.c b/src/testing/gnunet-testing.c index b850d6b13..a9e5042b2 100644 --- a/src/testing/gnunet-testing.c +++ b/src/testing/gnunet-testing.c | |||
@@ -436,7 +436,7 @@ main (int argc, char *const *argv) | |||
436 | GNUNET_YES)) | 436 | GNUNET_YES)) |
437 | ? ret | 437 | ? ret |
438 | : 1; | 438 | : 1; |
439 | GNUNET_free ((void *) argv); | 439 | GNUNET_free_nz ((void *) argv); |
440 | return ret; | 440 | return ret; |
441 | } | 441 | } |
442 | 442 | ||
diff --git a/src/testing/testing.c b/src/testing/testing.c index 3e447e1ff..23bc40d7e 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -1343,7 +1343,7 @@ GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer, | |||
1343 | return; | 1343 | return; |
1344 | } | 1344 | } |
1345 | peer->id = GNUNET_new (struct GNUNET_PeerIdentity); | 1345 | peer->id = GNUNET_new (struct GNUNET_PeerIdentity); |
1346 | GNUNET_free ( | 1346 | GNUNET_free_nz ( |
1347 | GNUNET_TESTING_hostkey_get (peer->system, peer->key_number, peer->id)); | 1347 | GNUNET_TESTING_hostkey_get (peer->system, peer->key_number, peer->id)); |
1348 | GNUNET_memcpy (id, peer->id, sizeof(struct GNUNET_PeerIdentity)); | 1348 | GNUNET_memcpy (id, peer->id, sizeof(struct GNUNET_PeerIdentity)); |
1349 | } | 1349 | } |
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index 261d825ea..c6f600df1 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c | |||
@@ -1130,7 +1130,7 @@ main (int argc, char *const *argv) | |||
1130 | NULL)) | 1130 | NULL)) |
1131 | ? 0 | 1131 | ? 0 |
1132 | : 1; | 1132 | : 1; |
1133 | GNUNET_free ((void *) argv); | 1133 | GNUNET_free_nz ((void *) argv); |
1134 | return ret; | 1134 | return ret; |
1135 | } | 1135 | } |
1136 | 1136 | ||
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index 82ee309a5..bbfacbffd 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c | |||
@@ -2285,7 +2285,7 @@ main (int argc, char *const *argv) | |||
2285 | NULL)) | 2285 | NULL)) |
2286 | ? 0 | 2286 | ? 0 |
2287 | : 1; | 2287 | : 1; |
2288 | GNUNET_free ((void *) argv); | 2288 | GNUNET_free_nz ((void *) argv); |
2289 | return ret; | 2289 | return ret; |
2290 | } | 2290 | } |
2291 | 2291 | ||
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c index e0b14f669..72e84567a 100644 --- a/src/transport/gnunet-communicator-udp.c +++ b/src/transport/gnunet-communicator-udp.c | |||
@@ -2791,7 +2791,7 @@ main (int argc, char *const *argv) | |||
2791 | NULL)) | 2791 | NULL)) |
2792 | ? 0 | 2792 | ? 0 |
2793 | : 1; | 2793 | : 1; |
2794 | GNUNET_free ((void *) argv); | 2794 | GNUNET_free_nz ((void *) argv); |
2795 | return ret; | 2795 | return ret; |
2796 | } | 2796 | } |
2797 | 2797 | ||
diff --git a/src/transport/gnunet-communicator-unix.c b/src/transport/gnunet-communicator-unix.c index 7d7f18a9c..31d2e4ed3 100644 --- a/src/transport/gnunet-communicator-unix.c +++ b/src/transport/gnunet-communicator-unix.c | |||
@@ -1135,7 +1135,7 @@ main (int argc, char *const *argv) | |||
1135 | NULL)) | 1135 | NULL)) |
1136 | ? 0 | 1136 | ? 0 |
1137 | : 1; | 1137 | : 1; |
1138 | GNUNET_free ((void *) argv); | 1138 | GNUNET_free_nz ((void *) argv); |
1139 | return ret; | 1139 | return ret; |
1140 | } | 1140 | } |
1141 | 1141 | ||
diff --git a/src/transport/gnunet-transport-profiler.c b/src/transport/gnunet-transport-profiler.c index 6c13cf059..81678fa20 100644 --- a/src/transport/gnunet-transport-profiler.c +++ b/src/transport/gnunet-transport-profiler.c | |||
@@ -615,7 +615,7 @@ main (int argc, char *const *argv) | |||
615 | options, | 615 | options, |
616 | &run, | 616 | &run, |
617 | NULL); | 617 | NULL); |
618 | GNUNET_free ((void *) argv); | 618 | GNUNET_free_nz ((void *) argv); |
619 | if (GNUNET_OK == res) | 619 | if (GNUNET_OK == res) |
620 | return ret; | 620 | return ret; |
621 | return 1; | 621 | return 1; |
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index 5a437b660..35da5ec10 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c | |||
@@ -1427,7 +1427,7 @@ main (int argc, char *const *argv) | |||
1427 | options, | 1427 | options, |
1428 | &run, | 1428 | &run, |
1429 | NULL); | 1429 | NULL); |
1430 | GNUNET_free ((void *) argv); | 1430 | GNUNET_free_nz ((void *) argv); |
1431 | if (GNUNET_OK == res) | 1431 | if (GNUNET_OK == res) |
1432 | return ret; | 1432 | return ret; |
1433 | return 1; | 1433 | return 1; |
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index f101e8b61..5883c1497 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -331,7 +331,7 @@ main (int argc, char *const *argv) | |||
331 | options, | 331 | options, |
332 | &run, | 332 | &run, |
333 | NULL); | 333 | NULL); |
334 | GNUNET_free ((void *) argv); | 334 | GNUNET_free_nz ((void *) argv); |
335 | if (GNUNET_OK == ret) | 335 | if (GNUNET_OK == ret) |
336 | return global_ret; | 336 | return global_ret; |
337 | return ret; | 337 | return ret; |
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c index 764a507b6..8e30ac416 100644 --- a/src/util/gnunet-ecc.c +++ b/src/util/gnunet-ecc.c | |||
@@ -501,7 +501,7 @@ main (int argc, char *const *argv) | |||
501 | NULL)) | 501 | NULL)) |
502 | ? 0 | 502 | ? 0 |
503 | : 1; | 503 | : 1; |
504 | GNUNET_free ((void *) argv); | 504 | GNUNET_free_nz ((void *) argv); |
505 | return ret; | 505 | return ret; |
506 | } | 506 | } |
507 | 507 | ||
diff --git a/src/util/gnunet-resolver.c b/src/util/gnunet-resolver.c index 6a602c64e..8a6c7fbe9 100644 --- a/src/util/gnunet-resolver.c +++ b/src/util/gnunet-resolver.c | |||
@@ -171,14 +171,18 @@ main (int argc, char *const *argv) | |||
171 | }; | 171 | }; |
172 | int ret; | 172 | int ret; |
173 | 173 | ||
174 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 174 | if (GNUNET_OK != |
175 | GNUNET_STRINGS_get_utf8_args (argc, argv, | ||
176 | &argc, &argv)) | ||
175 | return 2; | 177 | return 2; |
176 | 178 | ||
177 | ret = (GNUNET_OK == | 179 | ret = (GNUNET_OK == |
178 | GNUNET_PROGRAM_run (argc, argv, "gnunet-resolver [hostname]", | 180 | GNUNET_PROGRAM_run (argc, argv, |
181 | "gnunet-resolver [hostname]", | ||
179 | gettext_noop ("Use build-in GNUnet stub resolver"), | 182 | gettext_noop ("Use build-in GNUnet stub resolver"), |
180 | options, &run, NULL)) ? 0 : 1; | 183 | options, |
181 | GNUNET_free ((void *) argv); | 184 | &run, NULL)) ? 0 : 1; |
185 | GNUNET_free_nz ((void *) argv); | ||
182 | return ret; | 186 | return ret; |
183 | } | 187 | } |
184 | 188 | ||
diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c index 8c46136b9..70ba48d82 100644 --- a/src/util/gnunet-scrypt.c +++ b/src/util/gnunet-scrypt.c | |||
@@ -322,7 +322,7 @@ main (int argc, char *const *argv) | |||
322 | NULL)) | 322 | NULL)) |
323 | ? 0 | 323 | ? 0 |
324 | : 1; | 324 | : 1; |
325 | GNUNET_free ((void *) argv); | 325 | GNUNET_free_nz ((void *) argv); |
326 | GNUNET_free_non_null (pwfn); | 326 | GNUNET_free_non_null (pwfn); |
327 | return ret; | 327 | return ret; |
328 | } | 328 | } |
diff --git a/src/util/gnunet-uri.c b/src/util/gnunet-uri.c index 84100ff56..48c46ee49 100644 --- a/src/util/gnunet-uri.c +++ b/src/util/gnunet-uri.c | |||
@@ -184,7 +184,7 @@ main (int argc, char *const *argv) | |||
184 | shc_chld = NULL; | 184 | shc_chld = NULL; |
185 | GNUNET_DISK_pipe_close (sigpipe); | 185 | GNUNET_DISK_pipe_close (sigpipe); |
186 | sigpipe = NULL; | 186 | sigpipe = NULL; |
187 | GNUNET_free ((void *) argv); | 187 | GNUNET_free_nz ((void *) argv); |
188 | return ((GNUNET_OK == ret) && (0 == exit_code)) ? 0 : 1; | 188 | return ((GNUNET_OK == ret) && (0 == exit_code)) ? 0 : 1; |
189 | } | 189 | } |
190 | 190 | ||
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 45a6b61e5..93393bd7c 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -584,28 +584,26 @@ dump_backtrace (struct GNUNET_SCHEDULER_Task *t) | |||
584 | static void | 584 | static void |
585 | destroy_task (struct GNUNET_SCHEDULER_Task *t) | 585 | destroy_task (struct GNUNET_SCHEDULER_Task *t) |
586 | { | 586 | { |
587 | unsigned int i; | ||
588 | |||
589 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 587 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
590 | "destroying task %p\n", | 588 | "destroying task %p\n", |
591 | t); | 589 | t); |
592 | 590 | ||
593 | if (GNUNET_YES == t->own_handles) | 591 | if (GNUNET_YES == t->own_handles) |
594 | { | 592 | { |
595 | for (i = 0; i != t->fds_len; ++i) | 593 | for (unsigned int i = 0; i != t->fds_len; ++i) |
596 | { | 594 | { |
597 | const struct GNUNET_NETWORK_Handle *fd = t->fds[i].fd; | 595 | const struct GNUNET_NETWORK_Handle *fd = t->fds[i].fd; |
598 | const struct GNUNET_DISK_FileHandle *fh = t->fds[i].fh; | 596 | const struct GNUNET_DISK_FileHandle *fh = t->fds[i].fh; |
599 | if (fd) | 597 | if (fd) |
600 | { | 598 | { |
601 | GNUNET_NETWORK_socket_free_memory_only_ ((struct | 599 | GNUNET_NETWORK_socket_free_memory_only_ ( |
602 | GNUNET_NETWORK_Handle *) fd); | 600 | (struct GNUNET_NETWORK_Handle *) fd); |
603 | } | 601 | } |
604 | if (fh) | 602 | if (fh) |
605 | { | 603 | { |
606 | // FIXME: on WIN32 this is not enough! A function | 604 | // FIXME: on WIN32 this is not enough! A function |
607 | // GNUNET_DISK_file_free_memory_only would be nice | 605 | // GNUNET_DISK_file_free_memory_only would be nice |
608 | GNUNET_free ((void *) fh); | 606 | GNUNET_free_nz ((void *) fh); |
609 | } | 607 | } |
610 | } | 608 | } |
611 | } | 609 | } |
diff --git a/src/vpn/gnunet-vpn.c b/src/vpn/gnunet-vpn.c index 6dcd227c7..a7f7fc30c 100644 --- a/src/vpn/gnunet-vpn.c +++ b/src/vpn/gnunet-vpn.c | |||
@@ -357,7 +357,7 @@ main (int argc, char *const *argv) | |||
357 | NULL)) | 357 | NULL)) |
358 | ? ret | 358 | ? ret |
359 | : 1; | 359 | : 1; |
360 | GNUNET_free ((void *) argv); | 360 | GNUNET_free_nz ((void *) argv); |
361 | return ret; | 361 | return ret; |
362 | } | 362 | } |
363 | 363 | ||