]> granicus.if.org Git - python/commitdiff
Issue #19437: Fix PyCFuncPtrType constructor, handle
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 31 Oct 2013 15:34:08 +0000 (16:34 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 31 Oct 2013 15:34:08 +0000 (16:34 +0100)
_ctypes_alloc_format_string() failure

Modules/_ctypes/_ctypes.c

index 32d67b00f59c98453b45d5bb95a2e9927a999296..0deffa0a9f1de6f70d833447b635a4f242f3df4c 100644 (file)
@@ -2245,6 +2245,10 @@ PyCFuncPtrType_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
        argtypes would be a ctypes type).
     */
     stgdict->format = _ctypes_alloc_format_string(NULL, "X{}");
+    if (stgdict->format == NULL) {
+        Py_DECREF((PyObject *)stgdict);
+        return NULL;
+    }
     stgdict->flags |= TYPEFLAG_ISPOINTER;
 
     /* create the new instance (which is a class,