From: Michal Privoznik <mpriv...@redhat.com>

When virCHDriverConfig struct is initialized in
virCHDriverConfigNew() the 'configDir' member is allocated but
corresponding free is missing in virCHDriverConfigDispose().
While at it, reorder the free calls to match the order in which
they are declared in the struct so it's easier to spot missing
free call.

20 bytes in 1 blocks are definitely lost in loss record 667 of 2,033
   at 0x4912888: malloc (vg_replace_malloc.c:446)
   by 0x5436747: __vasprintf_internal (in /usr/lib64/libc.so.6)
   by 0x503EC81: g_vasprintf (in /usr/lib64/libglib-2.0.so.0.8400.3)
   by 0x500805B: g_strdup_vprintf (in /usr/lib64/libglib-2.0.so.0.8400.3)
   by 0x5008124: g_strdup_printf (in /usr/lib64/libglib-2.0.so.0.8400.3)
   by 0xB8C2B70: virCHDriverConfigNew (ch_conf.c:181)
   by 0xB8C9DDA: chStateInitialize (ch_driver.c:1456)
   by 0x4D9E316: virStateInitialize (libvirt.c:667)
   by 0x40539DB: daemonRunStateInit (remote_daemon.c:581)
   by 0x4AC1EB4: virThreadHelper (virthread.c:256)
   by 0x5441DE3: start_thread (in /usr/lib64/libc.so.6)
   by 0x54C25F3: clone (in /usr/lib64/libc.so.6)

Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
---
 src/ch/ch_conf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ch/ch_conf.c b/src/ch/ch_conf.c
index b9432e2a42..8a542eef19 100644
--- a/src/ch/ch_conf.c
+++ b/src/ch/ch_conf.c
@@ -211,9 +211,10 @@ virCHDriverConfigDispose(void *obj)
 {
     virCHDriverConfig *cfg = obj;
 
-    g_free(cfg->saveDir);
     g_free(cfg->stateDir);
+    g_free(cfg->configDir);
     g_free(cfg->logDir);
+    g_free(cfg->saveDir);
 }
 
 #define MIN_VERSION ((15 * 1000000) + (0 * 1000) + (0))
-- 
2.49.1

Reply via email to