mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-08-12 17:49:25 +03:00
Don't free passed in args in libvirt_charPtrWrap / libvirt_charPtrSizeWrap
Functions should not make assumptions about the memory management callers use for parameters Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
@ -6881,7 +6881,9 @@ libvirt_virStreamRecv(PyObject *self ATTRIBUTE_UNUSED,
|
|||||||
return libvirt_intWrap(ret);
|
return libvirt_intWrap(ret);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return VIR_PY_NONE;
|
return VIR_PY_NONE;
|
||||||
return libvirt_charPtrSizeWrap((char *) buf, (Py_ssize_t) ret);
|
ret = libvirt_charPtrSizeWrap((char *) buf, (Py_ssize_t) ret);
|
||||||
|
VIR_FREE(buf);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -85,7 +85,6 @@ libvirt_charPtrSizeWrap(char *str, Py_ssize_t size)
|
|||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
ret = PyString_FromStringAndSize(str, size);
|
ret = PyString_FromStringAndSize(str, size);
|
||||||
VIR_FREE(str);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +98,6 @@ libvirt_charPtrWrap(char *str)
|
|||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
ret = PyString_FromString(str);
|
ret = PyString_FromString(str);
|
||||||
VIR_FREE(str);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user