[python PATCH] fix crash introduced by commit 1d39dbaf

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

 



Some of the libvirt_*Wrap functions steals the reference and we need to
set the item in array to NULL no not free it on success.  Those three
places was accidentally removed by commit 1d39dbaf.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1270977

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---

Pushed as fix for critical crasher.

 libvirt-override.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libvirt-override.c b/libvirt-override.c
index c6c1da8..5f1c98f 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -2448,6 +2448,7 @@ libvirt_virDomainListAllSnapshots(PyObject *self ATTRIBUTE_UNUSED,
     for (i = 0; i < c_retval; i++) {
         VIR_PY_LIST_SET_GOTO(py_retval, i,
                              libvirt_virDomainSnapshotPtrWrap(snaps[i]), error);
+        snaps[i] = NULL;
     }
 
  cleanup:
@@ -2544,9 +2545,11 @@ libvirt_virDomainSnapshotListAllChildren(PyObject *self ATTRIBUTE_UNUSED,
     if (!(py_retval = PyList_New(c_retval)))
         goto cleanup;
 
-    for (i = 0; i < c_retval; i++)
+    for (i = 0; i < c_retval; i++) {
         VIR_PY_LIST_SET_GOTO(py_retval, i,
                              libvirt_virDomainSnapshotPtrWrap(snaps[i]), error);
+        snaps[i] = NULL;
+    }
 
  cleanup:
     for (i = 0; i < c_retval; i++)
@@ -3117,9 +3120,11 @@ libvirt_virConnectListAllNetworks(PyObject *self ATTRIBUTE_UNUSED,
     if (!(py_retval = PyList_New(c_retval)))
         goto cleanup;
 
-    for (i = 0; i < c_retval; i++)
+    for (i = 0; i < c_retval; i++) {
         VIR_PY_LIST_SET_GOTO(py_retval, i,
                              libvirt_virNetworkPtrWrap(nets[i]), error);
+        nets[i] = NULL;
+    }
 
  cleanup:
     for (i = 0; i < c_retval; i++)
-- 
2.6.2

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