commit c1de20451a1983aa3b9979464046933a88f79124
parent e29192eca47234ed93e63d6473eb92a3739781f7
Author: wwp <subscript@free.fr>
Date: Tue, 28 Sep 2021 14:09:28 +0200
Fix CID 1491121: resource leak.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/plugins/tnef_parse/tnef_parse.c b/src/plugins/tnef_parse/tnef_parse.c
@@ -97,7 +97,6 @@ static MimeInfo *tnef_dump_file(const gchar *filename, char *data, size_t size)
gchar *tmpfilename = NULL;
FILE *fp = get_tmpfile_in_dir(get_mime_tmp_dir(), &tmpfilename);
GStatBuf statbuf;
- gchar *content_type = NULL;
if (!fp) {
g_free(tmpfilename);
return NULL;
@@ -109,6 +108,8 @@ static MimeInfo *tnef_dump_file(const gchar *filename, char *data, size_t size)
sub_info->subtype = g_strdup("octet-stream");
if (filename) {
+ gchar *content_type = NULL;
+
g_hash_table_insert(sub_info->typeparameters,
g_strdup("filename"),
g_strdup(filename));
@@ -119,8 +120,9 @@ static MimeInfo *tnef_dump_file(const gchar *filename, char *data, size_t size)
sub_info->subtype = g_strdup(strchr(content_type, '/')+1);
*(strchr(content_type, '/')) = '\0';
sub_info->type = procmime_get_media_type(content_type);
- g_free(content_type);
}
+ if (content_type)
+ g_free(content_type);
}
if (claws_fwrite(data, 1, size, fp) < size) {