From 4a2837830bd7ab001ea20865964853da8f3cbd91 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 13 Dec 2012 11:34:09 +0000 Subject: [PATCH] another efm_op leak, also wrong E_FREE usage SVN revision: 80824 --- src/bin/e_fm_op.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/bin/e_fm_op.c b/src/bin/e_fm_op.c index c3baba53b..f9c0d9c8e 100644 --- a/src/bin/e_fm_op.c +++ b/src/bin/e_fm_op.c @@ -1242,17 +1242,30 @@ _e_fm_op_copy_link(E_Fm_Op_Task *task) if (symlink(lnk_path, task->dst.name) == -1) { + char buf[PATH_MAX]; + if (errno == EEXIST) { if (unlink(task->dst.name) == -1) - _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot unlink '%s': %s.", task->dst.name); + { + free(lnk_path); + _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot unlink '%s': %s.", task->dst.name); + } if (symlink(lnk_path, task->dst.name) == -1) - _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot create link from '%s' to '%s': %s.", lnk_path, task->dst.name); + { + strncat(buf, lnk_path, sizeof(buf)); + free(lnk_path); + _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot create link from '%s' to '%s': %s.", buf, task->dst.name); + } } else - _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot create link from '%s' to '%s': %s.", lnk_path, task->dst.name); + { + strncat(buf, lnk_path, sizeof(buf)); + free(lnk_path); + _E_FM_OP_ERROR_SEND_WORK(task, E_FM_OP_ERROR, "Cannot create link from '%s' to '%s': %s.", buf, task->dst.name); + } } - E_FREE(lnk_path); + free(lnk_path); task->dst.done += task->src.st.st_size;