talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit d8833eba98a94e586c755ac1d39d5ca444fa9cef
parent 38f6d3e79f57dee2dceb901381d67d20716722a5
Author: wwp <subscript@free.fr>
Date:   Tue, 28 Sep 2021 14:09:28 +0200

Fix CID 1491121: resource leak.

Diffstat:
Msrc/plugins/tnef_parse/tnef_parse.c | 6++++--
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) {