提交 3b0f0557 编写于 作者: M Martin Kletzander

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: NMartin Kletzander <mkletzan@redhat.com>
上级 f5070e3a
...@@ -3932,6 +3932,9 @@ virCgroupHasEmptyTasks(virCgroupPtr cgroup, int controller) ...@@ -3932,6 +3932,9 @@ virCgroupHasEmptyTasks(virCgroupPtr cgroup, int controller)
int ret = -1; int ret = -1;
char *content = NULL; char *content = NULL;
if (!cgroup)
return -1;
ret = virCgroupGetValueStr(cgroup, controller, "tasks", &content); ret = virCgroupGetValueStr(cgroup, controller, "tasks", &content);
if (ret == 0 && content[0] == '\0') if (ret == 0 && content[0] == '\0')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册