1
0
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:
Daniel P. Berrange
2013-12-11 16:12:14 +00:00
parent 6ea5be0dd2
commit bb3301ba78
2 changed files with 3 additions and 3 deletions

View File

@ -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 *

View File

@ -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;
}