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:
@ -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
|
||||
|
Reference in New Issue
Block a user