From: Victor Stinner Date: Thu, 31 Oct 2013 15:34:08 +0000 (+0100) Subject: Issue #19437: Fix PyCFuncPtrType constructor, handle X-Git-Tag: v3.4.0b1~450 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e75996a77ca1974ffa36f9b7be6cd9d3023c49e7;p=python Issue #19437: Fix PyCFuncPtrType constructor, handle _ctypes_alloc_format_string() failure --- diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 32d67b00f5..0deffa0a9f 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -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,