diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-07-23 13:07:27 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-07-23 13:07:27 +0000 |
commit | 9f9196e69f925d0185cbad021f4120d4af846531 (patch) | |
tree | f044fdd3d1a57e193567e9ac302102b4f4aa16c9 /src/gns/gnunet-gns.c | |
parent | 416da4e1bb7316f6a655e2727ec912d25c6ab40f (diff) | |
download | gnunet-9f9196e69f925d0185cbad021f4120d4af846531.tar.gz gnunet-9f9196e69f925d0185cbad021f4120d4af846531.zip |
-coverity
Diffstat (limited to 'src/gns/gnunet-gns.c')
-rw-r--r-- | src/gns/gnunet-gns.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index d1ef66331..b528c71f4 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c | |||
@@ -176,8 +176,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
176 | struct GNUNET_CRYPTO_ShortHashAsciiEncoded zonename; | 176 | struct GNUNET_CRYPTO_ShortHashAsciiEncoded zonename; |
177 | struct GNUNET_CRYPTO_RsaPrivateKey *shorten_key = NULL; | 177 | struct GNUNET_CRYPTO_RsaPrivateKey *shorten_key = NULL; |
178 | struct GNUNET_CRYPTO_RsaPrivateKey *private_key = NULL; | 178 | struct GNUNET_CRYPTO_RsaPrivateKey *private_key = NULL; |
179 | struct GNUNET_CRYPTO_ShortHashCode private_zone; | 179 | struct GNUNET_CRYPTO_ShortHashCode *private_zone = NULL; |
180 | struct GNUNET_CRYPTO_ShortHashCode shorten_zone; | 180 | struct GNUNET_CRYPTO_ShortHashCode *shorten_zone = NULL; |
181 | 181 | ||
182 | shorten_request = NULL; | 182 | shorten_request = NULL; |
183 | lookup_request = NULL; | 183 | lookup_request = NULL; |
@@ -224,10 +224,11 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
224 | { | 224 | { |
225 | shorten_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); | 225 | shorten_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); |
226 | GNUNET_CRYPTO_rsa_key_get_public (shorten_key, &pkey); | 226 | GNUNET_CRYPTO_rsa_key_get_public (shorten_key, &pkey); |
227 | shorten_zone = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_ShortHashCode)); | ||
227 | GNUNET_CRYPTO_short_hash(&pkey, | 228 | GNUNET_CRYPTO_short_hash(&pkey, |
228 | sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 229 | sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), |
229 | &shorten_zone); | 230 | shorten_zone); |
230 | GNUNET_CRYPTO_short_hash_to_enc (&shorten_zone, &zonename); | 231 | GNUNET_CRYPTO_short_hash_to_enc (shorten_zone, &zonename); |
231 | if (!raw) | 232 | if (!raw) |
232 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 233 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
233 | "Using shorten zone: %s!\n", &zonename); | 234 | "Using shorten zone: %s!\n", &zonename); |
@@ -251,10 +252,11 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
251 | { | 252 | { |
252 | private_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); | 253 | private_key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile); |
253 | GNUNET_CRYPTO_rsa_key_get_public (private_key, &pkey); | 254 | GNUNET_CRYPTO_rsa_key_get_public (private_key, &pkey); |
255 | private_zone = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_ShortHashCode)); | ||
254 | GNUNET_CRYPTO_short_hash(&pkey, | 256 | GNUNET_CRYPTO_short_hash(&pkey, |
255 | sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 257 | sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), |
256 | &private_zone); | 258 | private_zone); |
257 | GNUNET_CRYPTO_short_hash_to_enc (&private_zone, &zonename); | 259 | GNUNET_CRYPTO_short_hash_to_enc (private_zone, &zonename); |
258 | if (!raw) | 260 | if (!raw) |
259 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 261 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
260 | "Using private zone: %s!\n", &zonename); | 262 | "Using private zone: %s!\n", &zonename); |
@@ -293,8 +295,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
293 | if (NULL != shorten_name) | 295 | if (NULL != shorten_name) |
294 | { | 296 | { |
295 | shorten_request = GNUNET_GNS_shorten_zone (gns, shorten_name, | 297 | shorten_request = GNUNET_GNS_shorten_zone (gns, shorten_name, |
296 | &private_zone, | 298 | private_zone, |
297 | &shorten_zone, | 299 | shorten_zone, |
298 | zone, | 300 | zone, |
299 | &process_shorten_result, | 301 | &process_shorten_result, |
300 | shorten_name); | 302 | shorten_name); |
@@ -320,6 +322,12 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
320 | 322 | ||
321 | if (NULL != shorten_key) | 323 | if (NULL != shorten_key) |
322 | GNUNET_CRYPTO_rsa_key_free (shorten_key); | 324 | GNUNET_CRYPTO_rsa_key_free (shorten_key); |
325 | |||
326 | if (NULL != shorten_zone) | ||
327 | GNUNET_free (shorten_zone); | ||
328 | |||
329 | if (NULL != private_zone) | ||
330 | GNUNET_free (private_zone); | ||
323 | 331 | ||
324 | shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 332 | shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
325 | &do_shutdown, NULL); | 333 | &do_shutdown, NULL); |