From b7afcc36321b9a61b208f9cd4071f60a3894c1cf Mon Sep 17 00:00:00 2001 From: Arnavion Date: Mon, 8 Dec 2014 21:24:58 -0800 Subject: Don't leak filename_fs on errors. --- src/common/dcc.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/common/dcc.c b/src/common/dcc.c index 41d93be8..ebb89386 100644 --- a/src/common/dcc.c +++ b/src/common/dcc.c @@ -1824,10 +1824,10 @@ dcc_send (struct session *sess, char *to, char *filename, gint64 maxcps, int pas filename_fs = g_filename_from_utf8 (filename, -1, NULL, NULL, NULL); if (filename_fs == NULL) { - PrintTextf(sess, _("Cannot access %s\n"), dcc->file); - PrintTextf(sess, "%s %d: %s\n", _("Error"), errno, errorstring(errno)); + PrintTextf (sess, _("Cannot access %s\n"), dcc->file); + PrintTextf (sess, "%s %d: %s\n", _("Error"), errno, errorstring (errno)); - dcc_close(dcc, 0, TRUE); /* dcc_close will free dcc->file */ + dcc_close (dcc, 0, TRUE); /* dcc_close will free dcc->file */ return; } @@ -1835,6 +1835,13 @@ dcc_send (struct session *sess, char *to, char *filename, gint64 maxcps, int pas file = g_file_new_for_path (filename_fs); if (file == NULL) { + PrintTextf (sess, _("Cannot access %s\n"), dcc->file); + PrintTextf (sess, "%s %d: %s\n", _("Error"), errno, errorstring (errno)); + + dcc_close (dcc, 0, TRUE); /* dcc_close will free dcc->file */ + + g_free (filename_fs); + return; } @@ -1849,6 +1856,8 @@ dcc_send (struct session *sess, char *to, char *filename, gint64 maxcps, int pas dcc_close (dcc, 0, TRUE); /* dcc_close will free dcc->file */ + g_free (filename_fs); + return; } @@ -1863,6 +1872,8 @@ dcc_send (struct session *sess, char *to, char *filename, gint64 maxcps, int pas dcc_close (dcc, 0, TRUE); /* dcc_close will free dcc->file */ + g_free (filename_fs); + return; } -- cgit 1.4.1