diff options
author | rbuj <[email protected]> | 2021-10-22 10:30:10 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2022-01-29 15:00:59 +0100 |
commit | bb78fe4cb464589ac9670a1f1d31ad52c6a4f3d8 (patch) | |
tree | fac4bb3ffeccde8a8316b0009f02eca2b9d00d2a | |
parent | 1aa50457dce4d00cde74f65ea41f59ab1fdfb659 (diff) | |
download | engrampa-bb78fe4cb464589ac9670a1f1d31ad52c6a4f3d8.tar.bz2 engrampa-bb78fe4cb464589ac9670a1f1d31ad52c6a4f3d8.tar.xz |
file-data: fix memory leak
-rw-r--r-- | src/file-data.c | 11 | ||||
-rw-r--r-- | src/fr-command-tar.c | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/file-data.c b/src/file-data.c index 944844d..0496258 100644 --- a/src/file-data.c +++ b/src/file-data.c @@ -98,10 +98,15 @@ file_data_get_type (void) void file_data_update_content_type (FileData *fdata) { - if (fdata->dir) + if (fdata->dir) { fdata->content_type = MIME_TYPE_DIRECTORY; - else - fdata->content_type = get_static_string (g_content_type_guess (fdata->full_path, NULL, 0, NULL)); + } else { + char *content_type; + + content_type = g_content_type_guess (fdata->full_path, NULL, 0, NULL); + fdata->content_type = get_static_string (content_type); + g_free (content_type); + } } gboolean diff --git a/src/fr-command-tar.c b/src/fr-command-tar.c index 0452bb8..e73b214 100644 --- a/src/fr-command-tar.c +++ b/src/fr-command-tar.c @@ -138,8 +138,6 @@ process_line (char *line, g_free (name); name = g_filename_from_utf8 (fdata->original_path, -1, NULL, NULL, NULL); if (name) { - if (fdata->free_original_path) - g_free (fdata->original_path); fdata->original_path = g_strdup (name); fdata->free_original_path = TRUE; } |