mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-08-02 04:21:59 +03:00
Fix the incorrect memory freeing which will result in crash
Commit id '71fd95409' neglected to adjust a couple of API's do that now. The number of elements in new_params is equal to the length of info, instead of nparams, so it's wrong to free new_params using nparams. Signed-off-by: Wu Zongyong <wuzongyo@mail.ustc.edu.cn>
This commit is contained in:
@ -632,7 +632,7 @@ libvirt_virDomainSetSchedulerParametersFlags(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
int nparams = 0;
|
int nparams = 0;
|
||||||
Py_ssize_t size = 0;
|
Py_ssize_t size = 0;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
virTypedParameterPtr params, new_params = NULL;
|
virTypedParameterPtr params = NULL, new_params = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args,
|
if (!PyArg_ParseTuple(args,
|
||||||
(char *)"OOI:virDomainSetScedulerParametersFlags",
|
(char *)"OOI:virDomainSetScedulerParametersFlags",
|
||||||
@ -694,7 +694,7 @@ libvirt_virDomainSetSchedulerParametersFlags(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virTypedParamsFree(params, nparams);
|
virTypedParamsFree(params, nparams);
|
||||||
virTypedParamsFree(new_params, nparams);
|
virTypedParamsFree(new_params, size);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7739,7 +7739,7 @@ libvirt_virNodeSetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
int nparams = 0;
|
int nparams = 0;
|
||||||
Py_ssize_t size = 0;
|
Py_ssize_t size = 0;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
virTypedParameterPtr params, new_params = NULL;
|
virTypedParameterPtr params = NULL, new_params = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args,
|
if (!PyArg_ParseTuple(args,
|
||||||
(char *)"OOI:virNodeSetMemoryParameters",
|
(char *)"OOI:virNodeSetMemoryParameters",
|
||||||
@ -7798,7 +7798,7 @@ libvirt_virNodeSetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virTypedParamsFree(params, nparams);
|
virTypedParamsFree(params, nparams);
|
||||||
virTypedParamsFree(new_params, nparams);
|
virTypedParamsFree(new_params, size);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user