From 034ef75d494c5ee6d46c04c3659a5be121a943ca Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Mon, 7 Oct 2013 14:10:29 -0500 Subject: [PATCH] coverity: free dent_buf on error path (cgroup.c) Signed-off-by: Serge Hallyn --- src/lxc/cgroup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c index 49cc19055..5831e4e4c 100644 --- a/src/lxc/cgroup.c +++ b/src/lxc/cgroup.c @@ -1864,8 +1864,10 @@ int cgroup_recursive_task_count(const char *cgroup_path) process_lock(); d = opendir(cgroup_path); process_unlock(); - if (!d) + if (!d) { + free(dent_buf); return 0; + } while (readdir_r(d, dent_buf, &dent) == 0 && dent) { const char *parts[3] = {