From: Jan Safranek Date: Wed, 24 Aug 2011 09:46:20 +0000 (+0200) Subject: libcgroup: Fixed dereferencing of uninitialized variable when modifying a group X-Git-Tag: v0.38~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d57fa759b540fcb208e6f15ab52ba5000db9e84;p=thirdparty%2Flibcgroup.git 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 --- 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; }