[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 02/14] daemon: Fix memory leak in 'initrd-cat' (found by valgrind).



From: "Richard W.M. Jones" <rjones redhat com>

---
 daemon/initrd.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/daemon/initrd.c b/daemon/initrd.c
index 7c4d03f..d9c7050 100644
--- a/daemon/initrd.c
+++ b/daemon/initrd.c
@@ -108,9 +108,11 @@ do_initrd_cat (const char *path, const char *filename, size_t *size_r)
   int r = system (cmd);
   if (r == -1) {
     reply_with_perror ("command failed: %s", cmd);
+    free (cmd);
     rmdir (tmpdir);
     return NULL;
   }
+  free (cmd);
   if (WEXITSTATUS (r) != 0) {
     reply_with_perror ("command failed with return code %d",
                        WEXITSTATUS (r));
-- 
1.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]