summaryrefslogtreecommitdiffstats
path: root/api.c
diff options
context:
space:
mode:
authorDhaval Giani <dhaval@linux.vnet.ibm.com>2008-08-14 14:29:29 +0000
committerDhaval Giani <dhaval@linux.vnet.ibm.com>2008-08-14 14:29:29 +0000
commit82a65fa76807cbe17d8c700d93c7b0e3f0fee486 (patch)
tree5149b840231d4388f41828a3a2c45ede97f84edd /api.c
parent9ca76959994b6424df08eedc087173f08dd83ba2 (diff)
downloadlibcg-82a65fa76807cbe17d8c700d93c7b0e3f0fee486.tar.gz
libcg-82a65fa76807cbe17d8c700d93c7b0e3f0fee486.tar.xz
libcg-82a65fa76807cbe17d8c700d93c7b0e3f0fee486.zip
libcgroup: Fix up some free errors
Sudhir reported a free() issue, it got traced to this issue. https://sourceforge.net/tracker/index.php?func=detail&aid=2049822&group_id=218421&atid=1043649 Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Cc: Sudhir Kumar <skumar@linux.vnet.ibm.com> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@150 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'api.c')
-rw-r--r--api.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/api.c b/api.c
index 5b95466..e0a7b11 100644
--- a/api.c
+++ b/api.c
@@ -795,11 +795,10 @@ static int cgroup_fill_cgc(struct dirent *ctrl_dir, struct cgroup *cgroup,
if (cgroup_add_value_string(cgc, ctrl_dir->d_name,
ctrl_value)) {
error = ECGFAIL;
- goto fill_error;
}
+ free(ctrl_value);
}
fill_error:
- free(ctrl_value);
free(d_name);
return error;
}
@@ -861,7 +860,8 @@ struct cgroup *cgroup_get_cgroup(struct cgroup *cgroup)
* Get the uid and gid information
*/
- control_path = strdup(path);
+ control_path = malloc(strlen(path)+strlen("tasks") + 1);
+ strcpy(control_path, path);
if (!control_path)
goto unlock_error;