If the function fails it should always set an exception.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
typewrappers.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/typewrappers.c b/typewrappers.c
index 01ee310..99a8fb8 100644
--- a/typewrappers.c
+++ b/typewrappers.c
@@ -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
--
2.17.1