From: Meador Inge Date: Wed, 28 Sep 2011 01:35:28 +0000 (-0500) Subject: Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype. X-Git-Tag: v2.7.3rc1~438 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe150036803ce14efbf3a1e7bf923f47eded0179;p=python 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 e728c511e1..6c02a79c7a 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -720,6 +720,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 c4f0cb09fe..132ea5e08b 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -207,6 +207,9 @@ Library 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 c4d08901cd..4ae2c4133e 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -4678,6 +4678,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