1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-03 08:21:58 +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:
Pavel Hrdina
2018-06-12 07:00:22 +02:00
parent fb70ad1599
commit 181a30867a

View File

@ -384,8 +384,11 @@ libvirt_charPtrUnwrap(PyObject *obj,
#else
ret = PyString_AsString(obj);
#endif
if (ret)
if (ret) {
*str = strdup(ret);
if (!*str)
PyErr_NoMemory();
}
#if PY_MAJOR_VERSION > 2
Py_DECREF(bytes);
#endif