From: Martin Kletzander Date: Fri, 19 Dec 2014 16:40:41 +0000 (+0100) Subject: util: Fix possible NULL dereference X-Git-Tag: v1.2.12-rc1~142 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3b0f05573fbf385cca554d3383fad0089ed080cf;p=thirdparty%2Flibvirt.git util: Fix possible NULL dereference Commit 1a80b97d, which added the virCgroupHasEmptyTasks() function forgot that the parameter @cgroup may be NULL and did not check that. Signed-off-by: Martin Kletzander --- diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 4857ef3fed..64bc647db8 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -3932,6 +3932,9 @@ virCgroupHasEmptyTasks(virCgroupPtr cgroup, int controller) int ret = -1; char *content = NULL; + if (!cgroup) + return -1; + ret = virCgroupGetValueStr(cgroup, controller, "tasks", &content); if (ret == 0 && content[0] == '\0')