From 480196a05239bc14b7e448bde43be113ea022ec5 Mon Sep 17 00:00:00 2001 From: Dean Jansa Date: Fri, 10 Oct 2008 14:11:32 -0500 Subject: Fix the memory leak fix. The first attempt broke multiple file copy support. sendfiles should be re-written and broken into single file and multi-file cases to make this cleaner. Signed-off-by: Dean Jansa --- qacp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/qacp.c b/qacp.c index a8862e7..0a79f1e 100644 --- a/qacp.c +++ b/qacp.c @@ -572,12 +572,14 @@ sendfiles(char **argv, int argc, int fileidx, short recursive) destpath = strdup(rmtpath); } } else { + struct qp_rstat_pkt *tmprstatp; + /* rmtpath does not exist, check if the dirname does */ tmpstr = strdup(rmtpath); rdnp = strdup(dirname(tmpstr)); free(tmpstr); - rstatp = qacp_rstat(rdnp, &rstaterrno); + tmprstatp = qacp_rstat(rdnp, &rstaterrno); free(rdnp); if (rstatp) { @@ -586,8 +588,8 @@ sendfiles(char **argv, int argc, int fileidx, short recursive) * that /tmp exists, we leave destpath == rmtpath. */ destpath = strdup(rmtpath); - free(rstatp->qp_path); - free(rstatp); + free(tmprstatp->qp_path); + free(tmprstatp); } else { fprintf(stderr, "%s:%s - %s\n", rhost, rmtpath, strerror(rstaterrno)); @@ -600,14 +602,15 @@ sendfiles(char **argv, int argc, int fileidx, short recursive) free(lbnp); free(destpath); - free(rmtpath); } if (rstatp) { free(rstatp->qp_path); free(rstatp); } + free(ruser); + free(rmtpath); return 0; } -- cgit