]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Fix possible NULL dereference
authorMartin Kletzander <mkletzan@redhat.com>
Fri, 19 Dec 2014 16:40:41 +0000 (17:40 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Sun, 21 Dec 2014 09:30:49 +0000 (10:30 +0100)
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 <mkletzan@redhat.com>
src/util/vircgroup.c

index 4857ef3fed5bad78628bf4fecac2beff67f93879..64bc647db828299d45a3adda48699c8a3d8b1b25 100644 (file)
@@ -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')