From 411a26dffab450a6df51eff57d6044c650609169 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Fri, 4 Mar 2022 16:32:17 +0100 Subject: -make coverity happier !coverity --- src/dhtu/plugin_dhtu_gnunet.c | 1 + src/fs/fs_uri.c | 26 +++++++++++++++----------- src/gns/gnunet-bcd.c | 2 ++ src/gnsrecord/gnunet-gnsrecord-tvg.c | 2 ++ src/revocation/gnunet-revocation-tvg.c | 1 + 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/dhtu/plugin_dhtu_gnunet.c b/src/dhtu/plugin_dhtu_gnunet.c index fe97f4919..b072be2be 100644 --- a/src/dhtu/plugin_dhtu_gnunet.c +++ b/src/dhtu/plugin_dhtu_gnunet.c @@ -626,6 +626,7 @@ libgnunet_plugin_dhtu_gnunet_init (void *cls) (NULL == plugin->nse) ) { GNUNET_break (0); + GNUNET_free (api); libgnunet_plugin_dhtu_gnunet_done (plugin); return NULL; } diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c index 73ea5d60d..299dc3159 100644 --- a/src/fs/fs_uri.c +++ b/src/fs/fs_uri.c @@ -644,7 +644,6 @@ struct GNUNET_FS_Uri * GNUNET_FS_uri_parse (const char *uri, char **emsg) { struct GNUNET_FS_Uri *ret; - char *msg; if (NULL == uri) { @@ -653,18 +652,23 @@ GNUNET_FS_uri_parse (const char *uri, char **emsg) *emsg = GNUNET_strdup (_ ("invalid argument")); return NULL; } - if (NULL == emsg) - emsg = &msg; + /** + * FIXME: Do we want to log this? + */ *emsg = NULL; - if ((NULL != (ret = uri_chk_parse (uri, emsg))) || - (NULL != (ret = uri_ksk_parse (uri, emsg))) || - (NULL != (ret = uri_sks_parse (uri, emsg))) || - (NULL != (ret = uri_loc_parse (uri, emsg)))) + if (NULL != (ret = uri_chk_parse (uri, emsg))) + return ret; + GNUNET_free (*emsg); + if (NULL != (ret = uri_ksk_parse (uri, emsg))) + return ret; + GNUNET_free (*emsg); + if (NULL != (ret = uri_sks_parse (uri, emsg))) + return ret; + GNUNET_free (*emsg); + if (NULL != (ret = uri_loc_parse (uri, emsg))) return ret; - if (NULL == *emsg) - *emsg = GNUNET_strdup (_ ("Unrecognized URI type")); - if (emsg == &msg) - GNUNET_free (msg); + GNUNET_free (*emsg); + *emsg = GNUNET_strdup (_ ("Unrecognized URI type")); return NULL; } diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c index 83efcfba5..60fe25945 100644 --- a/src/gns/gnunet-bcd.c +++ b/src/gns/gnunet-bcd.c @@ -419,6 +419,8 @@ create_response (void *cls, "\\def\\gpglineone{%s}\n\\def\\gpglinetwo{%s}\n", line1, line2); + GNUNET_free (line1); + GNUNET_free (line2); } fprintf (deffile, diff --git a/src/gnsrecord/gnunet-gnsrecord-tvg.c b/src/gnsrecord/gnunet-gnsrecord-tvg.c index 91e652a40..87de32066 100644 --- a/src/gnsrecord/gnunet-gnsrecord-tvg.c +++ b/src/gnsrecord/gnunet-gnsrecord-tvg.c @@ -152,6 +152,7 @@ run_pkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, const char *label) sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), 8, 1); fprintf (stdout, "\n"); fprintf (stdout, "Zone identifier (ztype|zkey):\n"); + GNUNET_assert (0 < GNUNET_IDENTITY_key_get_length (&id_pub)); print_bytes (&id_pub, GNUNET_IDENTITY_key_get_length (&id_pub), 8); GNUNET_STRINGS_data_to_string (&id_pub, GNUNET_IDENTITY_key_get_length (&id_pub), @@ -272,6 +273,7 @@ run_edkey (struct GNUNET_GNSRECORD_Data *rd, int rd_count, const char*label) GNUNET_CRYPTO_EddsaPrivateKey), 8); fprintf (stdout, "\n"); fprintf (stdout, "Zone identifier (ztype|zkey):\n"); + GNUNET_assert (0 < GNUNET_IDENTITY_key_get_length (&id_pub)); print_bytes (&id_pub, GNUNET_IDENTITY_key_get_length (&id_pub), 8); GNUNET_STRINGS_data_to_string (&id_pub, GNUNET_IDENTITY_key_get_length (&id_pub), diff --git a/src/revocation/gnunet-revocation-tvg.c b/src/revocation/gnunet-revocation-tvg.c index 3ba5b56fa..a34a6bc98 100644 --- a/src/revocation/gnunet-revocation-tvg.c +++ b/src/revocation/gnunet-revocation-tvg.c @@ -159,6 +159,7 @@ run (void *cls, print_bytes (pow, GNUNET_REVOCATION_proof_get_size (pow), 8); + GNUNET_free (ph); } -- cgit v1.2.3