summaryrefslogtreecommitdiffstats
path: root/daemon/tar.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@trick.home.annexia.org>2009-05-19 12:05:06 +0100
committerRichard Jones <rjones@trick.home.annexia.org>2009-05-19 12:05:06 +0100
commit8b4819058243957c8fbbc92ef4fbbc0b46655380 (patch)
tree895465bb9375391b0ad5998dbaf0f5e8c9e15e68 /daemon/tar.c
parent135d55fe24bce65f8eb8ca50193eda8287fe7c9a (diff)
downloadlibguestfs-8b4819058243957c8fbbc92ef4fbbc0b46655380.tar.gz
libguestfs-8b4819058243957c8fbbc92ef4fbbc0b46655380.tar.xz
libguestfs-8b4819058243957c8fbbc92ef4fbbc0b46655380.zip
Fix a memory leak in handling of tar files.
Diffstat (limited to 'daemon/tar.c')
-rw-r--r--daemon/tar.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/daemon/tar.c b/daemon/tar.c
index a33ec3a0..9f4813ca 100644
--- a/daemon/tar.c
+++ b/daemon/tar.c
@@ -68,8 +68,10 @@ do_tar_in (const char *dir)
cancel_receive ();
errno = err;
reply_with_perror ("%s", cmd);
+ free (cmd);
return -1;
}
+ free (cmd);
r = receive_file (fwrite_cb, &fp);
if (r == -1) { /* write error */
@@ -123,8 +125,10 @@ do_tar_out (const char *dir)
fp = popen (cmd, "r");
if (fp == NULL) {
reply_with_perror ("%s", cmd);
+ free (cmd);
return -1;
}
+ free (cmd);
/* Now we must send the reply message, before the file contents. After
* this there is no opportunity in the protocol to send any error
@@ -190,8 +194,10 @@ do_tgz_in (const char *dir)
cancel_receive ();
errno = err;
reply_with_perror ("%s", cmd);
+ free (cmd);
return -1;
}
+ free (cmd);
r = receive_file (fwrite_cb, &fp);
if (r == -1) { /* write error */
@@ -245,8 +251,10 @@ do_tgz_out (const char *dir)
fp = popen (cmd, "r");
if (fp == NULL) {
reply_with_perror ("%s", cmd);
+ free (cmd);
return -1;
}
+ free (cmd);
/* Now we must send the reply message, before the file contents. After
* this there is no opportunity in the protocol to send any error