summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-03-22 10:57:19 +0100
committerZenWalker <[email protected]>2019-04-02 00:56:34 +0200
commitbf0478b2b950b49cca1fda1a97bafc72c942554f (patch)
treebce0ac3e7f5bac6fdd16a79086c0da9a86e13ce2
parent70050ca8f98012655963aec8cfc13f08388640c2 (diff)
downloadengrampa-bf0478b2b950b49cca1fda1a97bafc72c942554f.tar.bz2
engrampa-bf0478b2b950b49cca1fda1a97bafc72c942554f.tar.xz
actions: avoid use of memory after it is freed
Fixes Clang static analyzer warning: actions.c:137:5: warning: Use of memory after it is freed return full_uri; ^~~~~~~~~~~~~~~
-rw-r--r--src/actions.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/actions.c b/src/actions.c
index 974af9f..1b99dc6 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -126,13 +126,13 @@ get_full_uri (DlgNewData *data)
uri_ext = get_archive_filename_extension (uri);
default_ext = mime_type_desc[data->supported_types[idx-1]].default_ext;
- if (strcmp_null_tolerant (uri_ext, default_ext) != 0) {
+ if (strcmp_null_tolerant (uri_ext, default_ext) != 0)
full_uri = g_strconcat (uri, default_ext, NULL);
- g_free (uri);
- }
}
if (full_uri == NULL)
full_uri = uri;
+ else
+ g_free (uri);
return full_uri;
}