Re: [PATCH] util: Fix possible NULL dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 19.12.2014 18:15, Martin Kletzander wrote:
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@xxxxxxxxxx>
---
  src/util/vircgroup.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 4857ef3..64bc647 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')


ACK

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]