Re: [PATCH 1/4] qemu: Check if virQEMUCapsNewCopy(...) has failed

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

 



On 02/09/2017 09:13 AM, Marc Hartmayer wrote:
Check if virQEMUCapsNewCopy(...) has failed, thus a segmentation fault
in virQEMUCapsFilterByMachineType(...) will be avoided.

Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Bjoern Walk <bwalk@xxxxxxxxxxxxxxxxxx>
---
  src/qemu/qemu_capabilities.c | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 3247d25..399e314 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4928,6 +4928,10 @@ virQEMUCapsCacheLookupCopy(virCapsPtr caps,
ret = virQEMUCapsNewCopy(qemuCaps);
      virObjectUnref(qemuCaps);
+
+    if (!ret)
+        return NULL;
+
      virQEMUCapsFilterByMachineType(ret, machineType);
      return ret;
  }


ACK (and to respond to your self-reply, I don't think a cleanup: label is necessary. The function is too simple to bother cluttering it up).


I'll push these all in a minute (except 4/4, where I'm waiting for your approval to a small change)

--
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]
  Powered by Linux