mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-29 19:41:52 +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;
|
||||
Py_ssize_t size = 0;
|
||||
unsigned int flags;
|
||||
virTypedParameterPtr params, new_params = NULL;
|
||||
virTypedParameterPtr params = NULL, new_params = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple(args,
|
||||
(char *)"OOI:virDomainSetScedulerParametersFlags",
|
||||
@ -694,7 +694,7 @@ libvirt_virDomainSetSchedulerParametersFlags(PyObject *self ATTRIBUTE_UNUSED,
|
||||
|
||||
cleanup:
|
||||
virTypedParamsFree(params, nparams);
|
||||
virTypedParamsFree(new_params, nparams);
|
||||
virTypedParamsFree(new_params, size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -7739,7 +7739,7 @@ libvirt_virNodeSetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
|
||||
int nparams = 0;
|
||||
Py_ssize_t size = 0;
|
||||
unsigned int flags;
|
||||
virTypedParameterPtr params, new_params = NULL;
|
||||
virTypedParameterPtr params = NULL, new_params = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple(args,
|
||||
(char *)"OOI:virNodeSetMemoryParameters",
|
||||
@ -7798,7 +7798,7 @@ libvirt_virNodeSetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
|
||||
|
||||
cleanup:
|
||||
virTypedParamsFree(params, nparams);
|
||||
virTypedParamsFree(new_params, nparams);
|
||||
virTypedParamsFree(new_params, size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user