From: Meador Inge Date: Wed, 28 Sep 2011 01:45:30 +0000 (-0500) Subject: Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype. X-Git-Tag: v3.2.3rc1~548 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b86ecf4bd1bfe237fbaa7ac8098af76141b5caf1;p=thirdparty%2FPython%2Fcpython.git Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype. Thanks to Suman Saha for finding the bug and providing a patch. --- diff --git a/Misc/ACKS b/Misc/ACKS index a1edc77b2fe6..6845faaac627 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -774,6 +774,7 @@ Sam Rushing Mark Russell Nick Russo Sébastien Sablé +Suman Saha Hajime Saitou George Sakkis Rich Salz diff --git a/Misc/NEWS b/Misc/NEWS index 1b0373663ea8..b5c75b49cd84 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -82,6 +82,9 @@ Tests Extension Modules ----------------- +- Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype. + Thanks to Suman Saha for finding the bug and providing a patch. + - Issue #13022: Fix: _multiprocessing.recvfd() doesn't check that file descriptor was actually received. diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 17a00f5c19eb..8f378e246df6 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -4474,6 +4474,7 @@ PyCArrayType_from_ctype(PyObject *itemtype, Py_ssize_t length) if (!PyType_Check(itemtype)) { PyErr_SetString(PyExc_TypeError, "Expected a type object"); + Py_DECREF(key); return NULL; } #ifdef MS_WIN64