summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-10-22 10:30:10 +0200
committerraveit65 <[email protected]>2022-07-04 20:12:35 +0200
commit073c06814e0dcbb7bbdcecb867fc8c15d3fdddfa (patch)
tree8d9789de8347f130ec856cf7827ee6954ed3c354 /src
parentc0fadd464f227e7ebbfefd3fa54e578f1bb9998b (diff)
downloadengrampa-073c06814e0dcbb7bbdcecb867fc8c15d3fdddfa.tar.bz2
engrampa-073c06814e0dcbb7bbdcecb867fc8c15d3fdddfa.tar.xz
file-data: fix memory leak
Diffstat (limited to 'src')
-rw-r--r--src/file-data.c11
-rw-r--r--src/fr-command-tar.c7
2 files changed, 13 insertions, 5 deletions
diff --git a/src/file-data.c b/src/file-data.c
index 911a5e9..cc0832f 100644
--- a/src/file-data.c
+++ b/src/file-data.c
@@ -103,10 +103,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);
+ }
}
diff --git a/src/fr-command-tar.c b/src/fr-command-tar.c
index 50aae1a..6f7943f 100644
--- a/src/fr-command-tar.c
+++ b/src/fr-command-tar.c
@@ -140,8 +140,11 @@ process_line (char *line,
}
g_free (name);
name = g_filename_from_utf8 (fdata->original_path, -1, NULL, NULL, NULL);
- if (name)
- fdata->original_path = name;
+ if (name) {
+ fdata->original_path = g_strdup (name);
+ fdata->free_original_path = TRUE;
+ }
+ g_free (name);
if (fields[1] != NULL)
fdata->link = g_strdup (fields[1]);