diff Modules/_sqlite/module.c @ 49469:69ea12db9b28 2.5

Issue #4046: Backport of issue #3312's patch: fixes two crashes in the sqlite3 module.
author Gerhard Häring <gh@ghaering.de>
date Wed, 08 Oct 2008 08:45:16 +0000
parents 3e5fd2b70e5a
children 787b969d37f0
line wrap: on
line diff
--- a/Modules/_sqlite/module.c	Tue Sep 30 17:47:50 2008 +0000
+++ b/Modules/_sqlite/module.c	Wed Oct 08 08:45:16 2008 +0000
@@ -128,12 +128,15 @@
 {
     PyTypeObject* type;
     PyObject* caster;
+    int rc;
 
     if (!PyArg_ParseTuple(args, "OO", &type, &caster)) {
         return NULL;
     }
 
-    microprotocols_add(type, (PyObject*)&SQLitePrepareProtocolType, caster);
+    rc = microprotocols_add(type, (PyObject*)&SQLitePrepareProtocolType, caster);
+    if (rc == -1)
+        return NULL;
 
     Py_INCREF(Py_None);
     return Py_None;