diff options
author | Dhaval Giani <dhaval@linux.vnet.ibm.com> | 2008-08-14 14:29:29 +0000 |
---|---|---|
committer | Dhaval Giani <dhaval@linux.vnet.ibm.com> | 2008-08-14 14:29:29 +0000 |
commit | 82a65fa76807cbe17d8c700d93c7b0e3f0fee486 (patch) | |
tree | 5149b840231d4388f41828a3a2c45ede97f84edd | |
parent | 9ca76959994b6424df08eedc087173f08dd83ba2 (diff) | |
download | libcg-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
-rw-r--r-- | api.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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; |