Fix four memory leaks in guestfs.c revealed by valgrind.
authorRichard Jones <rjones@redhat.com>
Sat, 9 May 2009 12:31:08 +0000 (13:31 +0100)
committerRichard Jones <rjones@redhat.com>
Sat, 9 May 2009 12:31:08 +0000 (13:31 +0100)
src/guestfs.c

index be7b0c7..9fd943f 100644 (file)
@@ -308,6 +308,8 @@ guestfs_close (guestfs_h *g)
   }
   /* release mutex (XXX) */
 
   }
   /* release mutex (XXX) */
 
+  free (g->msg_in);
+  free (g->msg_out);
   free (g->last_error);
   free (g);
 }
   free (g->last_error);
   free (g);
 }
@@ -824,6 +826,11 @@ guestfs_launch (guestfs_h *g)
   /* Parent (library). */
   g->pid = r;
 
   /* Parent (library). */
   g->pid = r;
 
+  free (kernel);
+  kernel = NULL;
+  free (initrd);
+  initrd = NULL;
+
   /* Fork the recovery process off which will kill qemu if the parent
    * process fails to do so (eg. if the parent segfaults).
    */
   /* Fork the recovery process off which will kill qemu if the parent
    * process fails to do so (eg. if the parent segfaults).
    */