summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-03-22 10:57:19 +0100
committerPablo Barciela <[email protected]>2019-04-02 00:59:37 +0200
commitb7407f9a455b5f481b18ad90e89ad9b0351d864d (patch)
treea3d417e269ecb2b817f7748a28035eafa7762ae6
parent5cef9b4921147a89eda67f1f55dcf4ee1807af60 (diff)
downloadengrampa-b7407f9a455b5f481b18ad90e89ad9b0351d864d.tar.bz2
engrampa-b7407f9a455b5f481b18ad90e89ad9b0351d864d.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;
}