From 9d57fa759b540fcb208e6f15ab52ba5000db9e84 Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Wed, 24 Aug 2011 11:46:20 +0200 Subject: [PATCH] libcgroup: Fixed dereferencing of uninitialized variable when modifying a group When group->index == 0, uninitialized variable path might get freed. Path is always freed in the loop, so it is useless to free it before return. Signed-off-by: Jan Safranek --- src/api.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/api.c b/src/api.c index 207d076c..d68a4c81 100644 --- a/src/api.c +++ b/src/api.c @@ -1350,7 +1350,7 @@ int cgroup_modify_cgroup(struct cgroup *cgroup) { char *path, base[FILENAME_MAX]; int i; - int error; + int error = 0; int ret; if (!cgroup_initialized) @@ -1388,12 +1388,7 @@ int cgroup_modify_cgroup(struct cgroup *cgroup) goto err; } } - if (path) - free(path); - return 0; err: - if (path) - free(path); return error; } -- 2.47.2