lib: Fix memory leak when debugging enabled (found by valgrind).
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 24 Nov 2011 15:50:54 +0000 (15:50 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 24 Nov 2011 15:51:16 +0000 (15:51 +0000)
If you enabled debugging (eg. LIBGUESTFS_DEBUG=1) then every
debug message printed would be leaked.

src/guestfs.c

index f4b79e7..450ffd8 100644 (file)
@@ -373,6 +373,8 @@ guestfs___debug (guestfs_h *g, const char *fs, ...)
   if (len < 0) return;
 
   guestfs___call_callbacks_message (g, GUESTFS_EVENT_LIBRARY, msg, len);
+
+  free (msg);
 }
 
 /* Call trace messages.  These are enabled by setting g->trace, and