1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-25 02:32:27 -05:00

Don't leak filename_fs on errors.

This commit is contained in:
Arnavion 2014-12-08 21:24:58 -08:00
parent 73cd6487d0
commit b7afcc3632

View File

@ -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); filename_fs = g_filename_from_utf8 (filename, -1, NULL, NULL, NULL);
if (filename_fs == NULL) if (filename_fs == NULL)
{ {
PrintTextf(sess, _("Cannot access %s\n"), dcc->file); PrintTextf (sess, _("Cannot access %s\n"), dcc->file);
PrintTextf(sess, "%s %d: %s\n", _("Error"), errno, errorstring(errno)); 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; 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); file = g_file_new_for_path (filename_fs);
if (file == NULL) 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; 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 */ dcc_close (dcc, 0, TRUE); /* dcc_close will free dcc->file */
g_free (filename_fs);
return; 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 */ dcc_close (dcc, 0, TRUE); /* dcc_close will free dcc->file */
g_free (filename_fs);
return; return;
} }