diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i index bc957e57..458ae7f1 100644 --- a/lang/python/gpgme.i +++ b/lang/python/gpgme.i @@ -452,14 +452,24 @@ size++; } $result = PyList_New(size); + if ($result == NULL) + return NULL; /* raise */ for (i=0,curr=$1; inext) { PyObject *fragile, *o; fragile = SWIG_NewPointerObj(SWIG_as_voidptr(curr), $1_descriptor, %newpointer_flags); + if (fragile == NULL) + { + Py_DECREF($result); + return NULL; /* raise */ + } o = _pyme_wrap_result(fragile, "EngineInfo"); - if (o == NULL) - return NULL; /* raise */ Py_DECREF(fragile); + if (o == NULL) + { + Py_DECREF($result); + return NULL; /* raise */ + } PyList_SetItem($result, i, o); } }