git.annexia.org
/
libguestfs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
135d55f
)
Fix a memory leak in handling of tar files.
author
Richard Jones
<rjones@trick.home.annexia.org>
Tue, 19 May 2009 11:05:06 +0000
(12:05 +0100)
committer
Richard Jones
<rjones@trick.home.annexia.org>
Tue, 19 May 2009 11:05:06 +0000
(12:05 +0100)
daemon/tar.c
patch
|
blob
|
history
diff --git
a/daemon/tar.c
b/daemon/tar.c
index
a33ec3a
..
9f4813c
100644
(file)
--- 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);
cancel_receive ();
errno = err;
reply_with_perror ("%s", cmd);
+ free (cmd);
return -1;
}
return -1;
}
+ free (cmd);
r = receive_file (fwrite_cb, &fp);
if (r == -1) { /* write error */
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);
fp = popen (cmd, "r");
if (fp == NULL) {
reply_with_perror ("%s", cmd);
+ free (cmd);
return -1;
}
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
/* 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);
cancel_receive ();
errno = err;
reply_with_perror ("%s", cmd);
+ free (cmd);
return -1;
}
return -1;
}
+ free (cmd);
r = receive_file (fwrite_cb, &fp);
if (r == -1) { /* write error */
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);
fp = popen (cmd, "r");
if (fp == NULL) {
reply_with_perror ("%s", cmd);
+ free (cmd);
return -1;
}
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
/* Now we must send the reply message, before the file contents. After
* this there is no opportunity in the protocol to send any error