diff options
author | Pablo Barciela <[email protected]> | 2019-03-22 10:57:19 +0100 |
---|---|---|
committer | Pablo Barciela <[email protected]> | 2019-04-02 00:59:37 +0200 |
commit | b7407f9a455b5f481b18ad90e89ad9b0351d864d (patch) | |
tree | a3d417e269ecb2b817f7748a28035eafa7762ae6 /src/actions.c | |
parent | 5cef9b4921147a89eda67f1f55dcf4ee1807af60 (diff) | |
download | engrampa-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;
^~~~~~~~~~~~~~~
Diffstat (limited to 'src/actions.c')
-rw-r--r-- | src/actions.c | 6 |
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; } |