summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorArnavion <arnavion@gmail.com>2014-12-08 21:24:58 -0800
committerArnavion <arnavion@gmail.com>2014-12-08 21:24:58 -0800
commitb7afcc36321b9a61b208f9cd4071f60a3894c1cf (patch)
tree5e62b0df6387ae518cc646afa6eb81ed131c58d0 /src
parent73cd6487d0a0c1eac47226fae4cf878da0c14bfd (diff)
Don't leak filename_fs on errors.
Diffstat (limited to 'src')
-rw-r--r--src/common/dcc.c17
1 files changed, 14 insertions, 3 deletions
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;
 	}