summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2015-07-30 09:32:28 +0200
committerPeter Krempa <pkrempa@redhat.com>2015-07-30 09:32:28 +0200
commit0a59630a341f73f716e635a8635c053861695cf1 (patch)
treef1028fec1415beb0321155902c40c1b84a359408
parentfa21f3d927b29991741e2d7a8ebc2a920778ecba (diff)
downloadlibvirt-python-0a59630a341f73f716e635a8635c053861695cf1.tar.gz
iothread: Fix crash if virDomainGetIOThreadInfo returns errorv1.2.18
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
-rw-r--r--libvirt-override.c6
1 files 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;