]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
v2 [patch 3/6] libcgroup: Fix up memory leak in cgroup_basename
authorDhaval Giani <dhaval.giani@gmail.com>
Tue, 16 Nov 2010 13:29:48 +0000 (14:29 +0100)
committerDhaval Giani <dhaval.giani@gmail.com>
Tue, 16 Nov 2010 15:39:17 +0000 (16:39 +0100)
commit4db4bc1293b48cd4719ec3a91ec2688fae790e83
tree073a3e7ac55a22e051a6052c09bb5222e220ba8e
parentdee92cc308ff7c16b6cc9ff2ad07af88e8b543d6
v2 [patch 3/6] libcgroup: Fix up memory leak in cgroup_basename

We were not freeing up tmp_string if the strdup for basename failed.

Since we anyway need to free up tmp_string and return NULL if the
strdup failed, we don't really care about testing the return value
of the strdup, and therefore this check is not needed. Remove this
check then.

Thanks to Steve Grubb's review at
http://article.gmane.org/gmane.comp.lib.libcg.devel/2485

Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
Acked-By: Jan Safranek <jsafrane@redhat.com>
src/api.c