diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2013-11-27 07:06:18 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2013-11-27 07:06:18 +0000 |
commit | 6d46ef5c157b87f6a44e009b4fc7f60078ecce59 (patch) | |
tree | 29c488db9daf4fb7d26d8e56c69e6f5cc6b9b246 | |
parent | f6ae755743b4ca15509098a5374e93f7450770e4 (diff) |
fixed fp and memory leaks.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3300 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | libsylph/procmime.c | 2 | ||||
-rw-r--r-- | libsylph/procmsg.c | 10 | ||||
-rw-r--r-- | plugin/attachment_tool/attachment_tool.c | 1 | ||||
-rw-r--r-- | src/jpilot.c | 3 | ||||
-rw-r--r-- | src/template.c | 2 |
6 files changed, 26 insertions, 2 deletions
@@ -1,3 +1,13 @@ +2013-11-27 + + * src/template.c: template_load(): fixed fp leak on error. + * plugin/attachment_tool/attachment_tool.c: remove_attachment(): + fixed fp leak on error. + * libsylph/procmsg.c: procmsg_concat_partial_messages(): fixed fp + leaks on error. + * libsylph/procmime.c: procmime_parse_mailcap(): fixed fp leak. + * src/jpilot.c: jpilot_read_db_files(): fixed fp leak and memory leaks. + 2013-11-26 * src/headerview.c: headerview_show_xface(): make sure xface is nul diff --git a/libsylph/procmime.c b/libsylph/procmime.c index 99b0a310..86192599 100644 --- a/libsylph/procmime.c +++ b/libsylph/procmime.c @@ -1722,6 +1722,8 @@ static GList *procmime_parse_mailcap(const gchar *file) list = g_list_append(list, mailcap); } + fclose(fp); + return list; } diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c index 869c59de..fe65395a 100644 --- a/libsylph/procmsg.c +++ b/libsylph/procmsg.c @@ -2018,8 +2018,8 @@ gint procmsg_concat_partial_messages(GSList *mlist, const gchar *file) g_free(cur_id); skip: - fclose(fp); procmime_mimeinfo_free_all(mimeinfo); + fclose(fp); } if (!part_id) { @@ -2094,6 +2094,8 @@ skip: out_size = get_left_file_size(fp); if (out_size < 0) { g_warning("cannot tell left file size of part %d\n", i + 1); + procmime_mimeinfo_free_all(mimeinfo); + fclose(fp); fclose(tmp_fp); g_unlink(file); return -1; @@ -2101,6 +2103,8 @@ skip: empty_line_size = get_last_empty_line_size(fp, out_size); if (empty_line_size < 0) { g_warning("cannot get last empty line size of part %d\n", i + 1); + procmime_mimeinfo_free_all(mimeinfo); + fclose(fp); fclose(tmp_fp); g_unlink(file); return -1; @@ -2109,13 +2113,15 @@ skip: if (append_file_part(fp, ftell(fp), out_size - empty_line_size, tmp_fp) < 0) { g_warning("write failed\n"); + procmime_mimeinfo_free_all(mimeinfo); + fclose(fp); fclose(tmp_fp); g_unlink(file); return -1; } - fclose(fp); procmime_mimeinfo_free_all(mimeinfo); + fclose(fp); } fclose(tmp_fp); diff --git a/plugin/attachment_tool/attachment_tool.c b/plugin/attachment_tool/attachment_tool.c index 32ea4dd4..b7a324e4 100644 --- a/plugin/attachment_tool/attachment_tool.c +++ b/plugin/attachment_tool/attachment_tool.c @@ -211,6 +211,7 @@ static gboolean remove_attachment(MsgInfo *msginfo) if ((outfp = g_fopen(outfile, "wb")) == NULL) { g_free(outfile); g_free(infile); + fclose(fp); procmime_mimeinfo_free_all(mimeinfo); return FALSE; } diff --git a/src/jpilot.c b/src/jpilot.c index e0161cc1..ca8e391b 100644 --- a/src/jpilot.c +++ b/src/jpilot.c @@ -849,6 +849,7 @@ static gint jpilot_read_db_files( JPilotFile *pilotFile, GList **records ) { return MGU_ERROR_READ; } if (feof(in)) { + fclose(in); return MGU_EOF; } } @@ -866,6 +867,8 @@ static gint jpilot_read_db_files( JPilotFile *pilotFile, GList **records ) { break; } if (feof(in)) { + free_mem_rec_header(&mem_rh); + fclose(in); return MGU_EOF; } } diff --git a/src/template.c b/src/template.c index e121bd3b..3e8781fd 100644 --- a/src/template.c +++ b/src/template.c @@ -73,6 +73,7 @@ static Template *template_load(gchar *filename, guint tmplid) if (!tmpl->name) { g_warning("wrong template format\n"); template_free(tmpl); + fclose(fp); return NULL; } @@ -80,6 +81,7 @@ static Template *template_load(gchar *filename, guint tmplid) if (!tmpl->value) { g_warning("cannot read template body\n"); template_free(tmpl); + fclose(fp); return NULL; } fclose(fp); |