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/test_namestore_api_zone_iteration_stop.c | |
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/test_namestore_api_zone_iteration_stop.c')
-rw-r--r-- | src/namestore/test_namestore_api_zone_iteration_stop.c | 45 |
1 files changed, 19 insertions, 26 deletions
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, |