[python PATCH] iothread: Fix crash if virDomainGetIOThreadInfo returns error

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

 



The cleanup portion of libvirt_virDomainGetIOThreadInfo would try to
clean the returned structures but the count of iothreads was set to -1.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1248295
---
 libvirt-override.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libvirt-override.c b/libvirt-override.c
index 45c8afc..2398228 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -2104,8 +2104,10 @@ libvirt_virDomainGetIOThreadInfo(PyObject *self ATTRIBUTE_UNUSED,
     py_iothrinfo = NULL;

 cleanup:
-    for (i = 0; i < niothreads; i++)
-        virDomainIOThreadInfoFree(iothrinfo[i]);
+    if (niothreads > 0) {
+        for (i = 0; i < niothreads; i++)
+            virDomainIOThreadInfoFree(iothrinfo[i]);
+    }
     VIR_FREE(iothrinfo);
     Py_XDECREF(py_iothrinfo);
     return py_retval;
-- 
2.4.5

--
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]