From d3466b95673b3afc5d1d8a2a018bc160c561c389 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 28 Nov 2013 19:36:42 +0000 Subject: [PATCH] -fix memory leak --- src/namestore/gnunet-service-namestore.c | 39 ++++++++++++------------ 1 file 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) } -static void lookup_nick_it (void *cls, - const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, - const char *label, - unsigned int rd_count, - const struct GNUNET_GNSRECORD_Data *rd) +static void +lookup_nick_it (void *cls, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, + const char *label, + unsigned int rd_count, + const struct GNUNET_GNSRECORD_Data *rd) { - struct GNUNET_GNSRECORD_Data **res = (cls); - + struct GNUNET_GNSRECORD_Data **res = cls; int c; + if (0 != strcmp (label, GNUNET_GNS_MASTERZONE_STR)) { GNUNET_break (0); @@ -437,26 +438,27 @@ get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone) int res; res = GSN_database->lookup_records (GSN_database->cls, zone, - GNUNET_GNS_MASTERZONE_STR, &lookup_nick_it, &nick); - + GNUNET_GNS_MASTERZONE_STR, + &lookup_nick_it, &nick); if ((NULL == nick) || (GNUNET_OK != res)) { GNUNET_CRYPTO_ecdsa_key_get_public (zone, &pub); - GNUNET_log(GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, "No nick name set for zone `%s'\n", - GNUNET_CRYPTO_ecdsa_public_key_to_string (&pub)); + GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, + "No nick name set for zone `%s'\n", + GNUNET_GNSRECORD_z2s (&pub)); return NULL; } - return nick; } -static void merge_records (unsigned int rdc1, - const struct GNUNET_GNSRECORD_Data *rd1, - unsigned int rdc2, - const struct GNUNET_GNSRECORD_Data *rd2, - unsigned int *rdc_res, - struct GNUNET_GNSRECORD_Data **rd_res) +static void +merge_records (unsigned int rdc1, + const struct GNUNET_GNSRECORD_Data *rd1, + unsigned int rdc2, + const struct GNUNET_GNSRECORD_Data *rd2, + unsigned int *rdc_res, + struct GNUNET_GNSRECORD_Data **rd_res) { int c; size_t req; @@ -499,7 +501,6 @@ static void merge_records (unsigned int rdc1, } - /** * Generate a 'struct LookupNameResponseMessage' and send it to the * given client using the given notification context. -- 2.25.1