diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-11-28 19:36:42 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-11-28 19:36:42 +0000 |
commit | d3466b95673b3afc5d1d8a2a018bc160c561c389 (patch) | |
tree | 40a164180637472a12472bb00eed46dd30607af1 /src/namestore | |
parent | 0b4edaacb7ed1b7581a5039d7c602b38bc9a027d (diff) | |
download | gnunet-d3466b95673b3afc5d1d8a2a018bc160c561c389.tar.gz gnunet-d3466b95673b3afc5d1d8a2a018bc160c561c389.zip |
-fix memory leak
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 380b561c7..659827a05 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -397,15 +397,16 @@ client_lookup (struct GNUNET_SERVER_Client *client) | |||
397 | } | 397 | } |
398 | 398 | ||
399 | 399 | ||
400 | static void lookup_nick_it (void *cls, | 400 | static void |
401 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, | 401 | lookup_nick_it (void *cls, |
402 | const char *label, | 402 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, |
403 | unsigned int rd_count, | 403 | const char *label, |
404 | const struct GNUNET_GNSRECORD_Data *rd) | 404 | unsigned int rd_count, |
405 | const struct GNUNET_GNSRECORD_Data *rd) | ||
405 | { | 406 | { |
406 | struct GNUNET_GNSRECORD_Data **res = (cls); | 407 | struct GNUNET_GNSRECORD_Data **res = cls; |
407 | |||
408 | int c; | 408 | int c; |
409 | |||
409 | if (0 != strcmp (label, GNUNET_GNS_MASTERZONE_STR)) | 410 | if (0 != strcmp (label, GNUNET_GNS_MASTERZONE_STR)) |
410 | { | 411 | { |
411 | GNUNET_break (0); | 412 | GNUNET_break (0); |
@@ -437,26 +438,27 @@ get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone) | |||
437 | int res; | 438 | int res; |
438 | 439 | ||
439 | res = GSN_database->lookup_records (GSN_database->cls, zone, | 440 | res = GSN_database->lookup_records (GSN_database->cls, zone, |
440 | GNUNET_GNS_MASTERZONE_STR, &lookup_nick_it, &nick); | 441 | GNUNET_GNS_MASTERZONE_STR, |
441 | 442 | &lookup_nick_it, &nick); | |
442 | if ((NULL == nick) || (GNUNET_OK != res)) | 443 | if ((NULL == nick) || (GNUNET_OK != res)) |
443 | { | 444 | { |
444 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &pub); | 445 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &pub); |
445 | GNUNET_log(GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, "No nick name set for zone `%s'\n", | 446 | GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, |
446 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&pub)); | 447 | "No nick name set for zone `%s'\n", |
448 | GNUNET_GNSRECORD_z2s (&pub)); | ||
447 | return NULL; | 449 | return NULL; |
448 | } | 450 | } |
449 | |||
450 | return nick; | 451 | return nick; |
451 | } | 452 | } |
452 | 453 | ||
453 | 454 | ||
454 | static void merge_records (unsigned int rdc1, | 455 | static void |
455 | const struct GNUNET_GNSRECORD_Data *rd1, | 456 | merge_records (unsigned int rdc1, |
456 | unsigned int rdc2, | 457 | const struct GNUNET_GNSRECORD_Data *rd1, |
457 | const struct GNUNET_GNSRECORD_Data *rd2, | 458 | unsigned int rdc2, |
458 | unsigned int *rdc_res, | 459 | const struct GNUNET_GNSRECORD_Data *rd2, |
459 | struct GNUNET_GNSRECORD_Data **rd_res) | 460 | unsigned int *rdc_res, |
461 | struct GNUNET_GNSRECORD_Data **rd_res) | ||
460 | { | 462 | { |
461 | int c; | 463 | int c; |
462 | size_t req; | 464 | size_t req; |
@@ -499,7 +501,6 @@ static void merge_records (unsigned int rdc1, | |||
499 | } | 501 | } |
500 | 502 | ||
501 | 503 | ||
502 | |||
503 | /** | 504 | /** |
504 | * Generate a 'struct LookupNameResponseMessage' and send it to the | 505 | * Generate a 'struct LookupNameResponseMessage' and send it to the |
505 | * given client using the given notification context. | 506 | * given client using the given notification context. |