From 3b0f05573fbf385cca554d3383fad0089ed080cf Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Fri, 19 Dec 2014 17:40:41 +0100 Subject: [PATCH] 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 --- src/util/vircgroup.c | 3 +++ 1 file changed, 3 insertions(+) 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')