Blame SOURCES/libvirt-python-iothread-Fix-crash-if-virDomainGetIOThreadInfo-returns-error.patch

b06491
From 6971993051ba16c374d7385e7ab65fa7f3b57e0c Mon Sep 17 00:00:00 2001
b06491
Message-Id: <6971993051ba16c374d7385e7ab65fa7f3b57e0c@dist-git>
b06491
From: Peter Krempa <pkrempa@redhat.com>
b06491
Date: Thu, 30 Jul 2015 10:04:02 +0200
b06491
Subject: [PATCH] iothread: Fix crash if virDomainGetIOThreadInfo returns error
b06491
b06491
The cleanup portion of libvirt_virDomainGetIOThreadInfo would try to
b06491
clean the returned structures but the count of iothreads was set to -1.
b06491
b06491
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1248295
b06491
(cherry picked from commit 0a59630a341f73f716e635a8635c053861695cf1)
b06491
b06491
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
b06491
---
b06491
 libvirt-override.c | 6 ++++--
b06491
 1 file changed, 4 insertions(+), 2 deletions(-)
b06491
b06491
diff --git a/libvirt-override.c b/libvirt-override.c
b06491
index 45c8afc..2398228 100644
b06491
--- a/libvirt-override.c
b06491
+++ b/libvirt-override.c
b06491
@@ -2104,8 +2104,10 @@ libvirt_virDomainGetIOThreadInfo(PyObject *self ATTRIBUTE_UNUSED,
b06491
     py_iothrinfo = NULL;
b06491
 
b06491
 cleanup:
b06491
-    for (i = 0; i < niothreads; i++)
b06491
-        virDomainIOThreadInfoFree(iothrinfo[i]);
b06491
+    if (niothreads > 0) {
b06491
+        for (i = 0; i < niothreads; i++)
b06491
+            virDomainIOThreadInfoFree(iothrinfo[i]);
b06491
+    }
b06491
     VIR_FREE(iothrinfo);
b06491
     Py_XDECREF(py_iothrinfo);
b06491
     return py_retval;
b06491
-- 
b06491
2.5.0
b06491