Dunno what is this test for, I'm just fixing two simple memory leaks there.
Signed-off-by: Jan Safranek <jsafr...@redhat.com> --- tests/libcg_ba.cpp | 13 ++----------- 1 files changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/libcg_ba.cpp b/tests/libcg_ba.cpp index 322794b..8f718cd 100644 --- a/tests/libcg_ba.cpp +++ b/tests/libcg_ba.cpp @@ -65,7 +65,6 @@ struct cgroup *cg::makenode(const string &name, const string &task_uid, { uid_t tuid, cuid; gid_t tgid, cgid; - char *cgroup_name; struct cgroup *ccg; struct cgroup_controller *cpu, *cpuacct; struct passwd *passwd; @@ -94,10 +93,7 @@ struct cgroup *cg::makenode(const string &name, const string &task_uid, cgroup_dbg("tuid %d, tgid %d, cuid %d, cgid %d\n", tuid, tgid, cuid, cgid); - cgroup_name = (char *) malloc(name.length()); - strncpy(cgroup_name, name.c_str(), name.length() + 1); - - ccg = cgroup_new_cgroup(cgroup_name); + ccg = cgroup_new_cgroup(name.c_str()); cgroup_set_uid_gid(ccg, tuid, tgid, cuid, cgid); cpu = cgroup_add_controller(ccg, "cpu"); cgroup_add_value_uint64(cpu, "cpu.shares", 2048); @@ -117,15 +113,10 @@ struct cgroup *cg::makenode(const string &name, const string &task_uid, struct cgroup *cg::makenodefromparent(const string &name) { - char *cgroup_name; struct cgroup *ccg; int ret; - cgroup_name = (char *) malloc(name.length()); - memset(cgroup_name, '\0', name.length()); - strcpy(cgroup_name, name.c_str()); - - ccg = cgroup_new_cgroup(cgroup_name); + ccg = cgroup_new_cgroup(name.c_str()); ret = cgroup_create_cgroup_from_parent(ccg, 1); if (ret) { cout << "cg create group failed " << errno << endl; ------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-dev2dev _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel