summaryrefslogtreecommitdiff
path: root/typewrappers.c
diff options
context:
space:
mode:
authorPavel Hrdina <phrdina@redhat.com>2018-06-12 07:00:22 +0200
committerPavel Hrdina <phrdina@redhat.com>2018-06-12 10:27:33 +0200
commit181a30867ad83a50e3d09a01dbb9a62a7d2824aa (patch)
tree82a5a3dc11b4d982f1e537781f0d57023a399aa3 /typewrappers.c
parentfb70ad159992c2290ae73a243682982e778dd796 (diff)
downloadlibvirt-python-181a30867ad83a50e3d09a01dbb9a62a7d2824aa.tar.gz
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>
Diffstat (limited to 'typewrappers.c')
-rw-r--r--typewrappers.c5
1 files changed, 4 insertions, 1 deletions
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