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 /src/namestore | |
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
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/gnunet-namestore-fcfsd.c | 2 | ||||
-rw-r--r-- | src/namestore/gnunet-namestore.c | 4 | ||||
-rw-r--r-- | src/namestore/gnunet-zoneimport.c | 2 | ||||
-rw-r--r-- | src/namestore/plugin_rest_namestore.c | 2 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_lookup_private.c | 2 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_lookup_public.c | 2 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_lookup_shadow.c | 2 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_lookup_shadow_filter.c | 4 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_monitoring.c | 6 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_monitoring_existing.c | 6 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_remove.c | 2 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_store.c | 2 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_store_update.c | 2 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_zone_iteration.c | 42 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_zone_iteration_nick.c | 6 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_zone_iteration_specific_zone.c | 6 | ||||
-rw-r--r-- | src/namestore/test_namestore_api_zone_iteration_stop.c | 45 |
17 files changed, 62 insertions, 75 deletions
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, |