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/namecache/test_namecache_api_cache_block.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/namecache/test_namecache_api_cache_block.c')
-rw-r--r-- | src/namecache/test_namecache_api_cache_block.c | 19 |
1 files changed, 8 insertions, 11 deletions
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 | ||