From: Richard W.M. Jones Date: Thu, 24 Nov 2011 15:50:54 +0000 (+0000) Subject: lib: Fix memory leak when debugging enabled (found by valgrind). X-Git-Tag: 1.15.6~7 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=dd76ce2b4c93dd10d8eca9ab7c77bc831f103d03;p=libguestfs.git lib: Fix memory leak when debugging enabled (found by valgrind). If you enabled debugging (eg. LIBGUESTFS_DEBUG=1) then every debug message printed would be leaked. --- diff --git a/src/guestfs.c b/src/guestfs.c index f4b79e7..450ffd8 100644 --- a/src/guestfs.c +++ b/src/guestfs.c @@ -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