summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Jansa <djansa@redhat.com>2008-10-10 14:11:32 -0500
committerNathan Straz <nstraz@redhat.com>2008-10-10 15:21:52 -0400
commit480196a05239bc14b7e448bde43be113ea022ec5 (patch)
tree9a133eae8ecacdd5e5a4f029309b51f3f02df279
parent9b4838cedb39bd8b31c9fa706ea903f3af2a540d (diff)
downloadqarsh-480196a05239bc14b7e448bde43be113ea022ec5.zip
qarsh-480196a05239bc14b7e448bde43be113ea022ec5.tar.gz
qarsh-480196a05239bc14b7e448bde43be113ea022ec5.tar.xz
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 <djansa@redhat.com>
-rw-r--r--qacp.c11
1 files 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;
}