From 82a65fa76807cbe17d8c700d93c7b0e3f0fee486 Mon Sep 17 00:00:00 2001 From: Dhaval Giani Date: Thu, 14 Aug 2008 14:29:29 +0000 Subject: 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 Cc: Sudhir Kumar Acked-by: Balbir Singh git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@150 4f4bb910-9a46-0410-90c8-c897d4f1cd53 --- api.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'api.c') 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; -- cgit