[Pkg-gnupg-commit] [gpgme] 358/412: python: Improve error handling.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 22 21:27:19 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gpgme.

commit 44d18200d5ffe8691e18d93ce6c534660702b982
Author: Justus Winter <justus at g10code.com>
Date:   Wed Sep 14 14:34:14 2016 +0200

    python: Improve error handling.
    
    * lang/python/gpgme.i (gpgme_engine_info_t): Improve error handling.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 lang/python/gpgme.i | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index bc957e5..458ae7f 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; i<size; i++,curr=curr->next) {
     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);
   }
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list