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
1 changed files with 14 additions and 3 deletions

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);
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;
}