mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-08-02 04:21:59 +03:00
fix crash in getAllDomainStats
Commits1d39dbaf
and827ed9b4
broke the libvirt-python API by removing virDomainRef() and virDomainFree(). virDomainStatsRecordListFree() will free that domain pointer and later when virDomain (python object) call its destructor and tries to free that same pointer again. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1326839 Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
@ -8381,6 +8381,7 @@ convertDomainStatsRecord(virDomainStatsRecordPtr *records,
|
||||
PyObject *py_retval;
|
||||
PyObject *py_record;
|
||||
PyObject *py_record_stats = NULL;
|
||||
virDomainPtr dom = NULL;
|
||||
size_t i;
|
||||
|
||||
if (!(py_retval = PyList_New(nrecords)))
|
||||
@ -8392,9 +8393,12 @@ convertDomainStatsRecord(virDomainStatsRecordPtr *records,
|
||||
|
||||
VIR_PY_LIST_SET_GOTO(py_retval, i, py_record, error);
|
||||
|
||||
dom = records[i]->dom;
|
||||
virDomainRef(dom);
|
||||
VIR_PY_TUPLE_SET_GOTO(py_record, 0,
|
||||
libvirt_virDomainPtrWrap(records[i]->dom),
|
||||
libvirt_virDomainPtrWrap(dom),
|
||||
error);
|
||||
dom = NULL;
|
||||
|
||||
if (!(py_record_stats = getPyVirTypedParameter(records[i]->params,
|
||||
records[i]->nparams)))
|
||||
@ -8406,6 +8410,8 @@ convertDomainStatsRecord(virDomainStatsRecordPtr *records,
|
||||
return py_retval;
|
||||
|
||||
error:
|
||||
if (dom)
|
||||
virDomainFree(dom);
|
||||
Py_XDECREF(py_retval);
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user