diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-03-05 08:58:51 +0100 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-03-05 08:58:51 +0100 |
commit | 2087b149d9a63eac15bbe9f03b0550d17d83eedb (patch) | |
tree | 35b45c203b74f53ce1ea0d4f03604f6c76b691bf | |
parent | 343177a0bcd25dea2ff651d847fb700a584300f3 (diff) |
FS: Fix segfault in URI handling
-rw-r--r-- | src/fs/fs_uri.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c index 299dc3159..dff94ee26 100644 --- a/src/fs/fs_uri.c +++ b/src/fs/fs_uri.c @@ -644,6 +644,7 @@ struct GNUNET_FS_Uri * GNUNET_FS_uri_parse (const char *uri, char **emsg) { struct GNUNET_FS_Uri *ret; + char *msg; if (NULL == uri) { @@ -655,20 +656,25 @@ GNUNET_FS_uri_parse (const char *uri, char **emsg) /** * FIXME: Do we want to log this? */ - *emsg = NULL; - if (NULL != (ret = uri_chk_parse (uri, emsg))) + msg = NULL; + if (NULL != (ret = uri_chk_parse (uri, &msg))) return ret; - GNUNET_free (*emsg); - if (NULL != (ret = uri_ksk_parse (uri, emsg))) + if (NULL != msg) + GNUNET_free (msg); + if (NULL != (ret = uri_ksk_parse (uri, &msg))) return ret; - GNUNET_free (*emsg); - if (NULL != (ret = uri_sks_parse (uri, emsg))) + if (NULL != msg) + GNUNET_free (msg); + if (NULL != (ret = uri_sks_parse (uri, &msg))) return ret; - GNUNET_free (*emsg); - if (NULL != (ret = uri_loc_parse (uri, emsg))) + if (NULL != msg) + GNUNET_free (msg); + if (NULL != (ret = uri_loc_parse (uri, &msg))) return ret; - GNUNET_free (*emsg); - *emsg = GNUNET_strdup (_ ("Unrecognized URI type")); + if (NULL != msg) + GNUNET_free (msg); + if (NULL != emsg) + *emsg = GNUNET_strdup (_ ("Unrecognized URI type")); return NULL; } |