mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-08-04 12:21:57 +03:00
typewrappers: Fix libvirt_charPtrUnwrap to set an exception if it fails
If the function fails it should always set an exception. Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
@ -384,8 +384,11 @@ libvirt_charPtrUnwrap(PyObject *obj,
|
|||||||
#else
|
#else
|
||||||
ret = PyString_AsString(obj);
|
ret = PyString_AsString(obj);
|
||||||
#endif
|
#endif
|
||||||
if (ret)
|
if (ret) {
|
||||||
*str = strdup(ret);
|
*str = strdup(ret);
|
||||||
|
if (!*str)
|
||||||
|
PyErr_NoMemory();
|
||||||
|
}
|
||||||
#if PY_MAJOR_VERSION > 2
|
#if PY_MAJOR_VERSION > 2
|
||||||
Py_DECREF(bytes);
|
Py_DECREF(bytes);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user