[lxc-devel] memory leak

Dwight Engen dwight.engen at oracle.com
Thu Sep 26 22:58:11 UTC 2013


Hi guys,

So the line:

  r = lxc_grow_array((void ***)&h->all_mount_points,
                     &h->all_mount_point_capacity, k + 1, 4);

in cgroup.c shows up in valgrind as a leak. I thought the appropriate
fix was:

diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c
index e27bc03..c5dc7e2 100644
--- a/src/lxc/cgroup.c
+++ b/src/lxc/cgroup.c
@@ -1563,6 +1563,7 @@ void lxc_cgroup_hierarchy_free(struct
cgroup_hierarchy *h) if (!h)
 		return;
 	lxc_free_array((void **)h->subsystems, free);
+	lxc_free_array((void **)h->all_mount_points, free);
 	free(h);
 }
 
which does free the allocated memory, but then causes a segv the next
time free(line) in find_hierarchy_mountpts() is called. The trap is in
libc::malloc_consolidate() so I think there is heap corruption going
on. Any ideas?




More information about the lxc-devel mailing list