mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-28 15:41:52 +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);
|
||||
if (ret < 0)
|
||||
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 *
|
||||
|
@ -85,7 +85,6 @@ libvirt_charPtrSizeWrap(char *str, Py_ssize_t size)
|
||||
return Py_None;
|
||||
}
|
||||
ret = PyString_FromStringAndSize(str, size);
|
||||
VIR_FREE(str);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -99,7 +98,6 @@ libvirt_charPtrWrap(char *str)
|
||||
return Py_None;
|
||||
}
|
||||
ret = PyString_FromString(str);
|
||||
VIR_FREE(str);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user