diff options
author | Arnav Singh <arnavion@gmail.com> | 2012-11-05 03:04:08 +0100 |
---|---|---|
committer | Berke Viktor <bviktor@hexchat.org> | 2012-11-05 03:04:08 +0100 |
commit | d142c74c15ca661fc5f94b98d3c0717c8e395e27 (patch) | |
tree | 49fec8cb22e722549afb4be7e56c77bc30d9fac1 /src/common | |
parent | 47244431245763f05a14771f186fa1518529a289 (diff) |
Fix erroneous DCC file names and crash upon aborting
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/dcc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/common/dcc.c b/src/common/dcc.c index cdee4249..58e04749 100644 --- a/src/common/dcc.c +++ b/src/common/dcc.c @@ -1829,11 +1829,9 @@ dcc_send (struct session *sess, char *to, char *file, int maxcps, int passive) dcc->fp = g_open (file, OFLAGS | O_RDONLY, 0); if (dcc->fp != -1) { - g_free (file); if (passive || dcc_listen_init (dcc, sess)) { char havespaces = 0; - file = dcc->file; while (*file) { if (*file == ' ') @@ -1857,11 +1855,12 @@ dcc_send (struct session *sess, char *to, char *file, int maxcps, int passive) { dcc->pasvid = new_id(); snprintf (outbuf, sizeof (outbuf), (havespaces) ? - "DCC SEND \"%s\" 199 0 %"DCC_SFMT" %d" : - "DCC SEND %s 199 0 %"DCC_SFMT" %d", + "DCC SEND \"%s\" 199 0 %" DCC_SFMT " %d" : + "DCC SEND %s 199 0 %" DCC_SFMT " %d", file_part (dcc->file), dcc->size, dcc->pasvid); - } else + } + else { snprintf (outbuf, sizeof (outbuf), (havespaces) ? "DCC SEND \"%s\" %u %d %"DCC_SFMT : @@ -1883,7 +1882,7 @@ dcc_send (struct session *sess, char *to, char *file, int maxcps, int passive) PrintTextf (sess, _("Cannot access %s\n"), dcc->file); PrintTextf (sess, "%s %d: %s\n", _("Error"), errno, errorstring (errno)); xit: - dcc_close (dcc, 0, TRUE); + dcc_close (dcc, 0, TRUE); /* dcc_close will free dcc->file */ } static struct DCC * |