diff options
author | Pavel Hrdina <phrdina@redhat.com> | 2018-06-12 07:00:22 +0200 |
---|---|---|
committer | Pavel Hrdina <phrdina@redhat.com> | 2018-06-12 10:27:33 +0200 |
commit | 181a30867ad83a50e3d09a01dbb9a62a7d2824aa (patch) | |
tree | 82a5a3dc11b4d982f1e537781f0d57023a399aa3 /typewrappers.c | |
parent | fb70ad159992c2290ae73a243682982e778dd796 (diff) | |
download | libvirt-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.c | 5 |
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 |