From b86ecf4bd1bfe237fbaa7ac8098af76141b5caf1 Mon Sep 17 00:00:00 2001 From: Meador Inge Date: Tue, 27 Sep 2011 20:45:30 -0500 Subject: Issue #13013: ctypes: Fix a reference leak in PyCArrayType_from_ctype. Thanks to Suman Saha for finding the bug and providing a patch. --- Misc/ACKS | 1 + Misc/NEWS | 3 +++ Modules/_ctypes/_ctypes.c | 1 + 3 files changed, 5 insertions(+) diff --git a/Misc/ACKS b/Misc/ACKS index a1edc77..6845faa 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 1b03736..b5c75b4 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 17a00f5..8f378e2 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 -- cgit v0.12