From: Xiang Zhang Date: Tue, 18 Jul 2017 16:33:29 +0000 (+0800) Subject: bpo-30961: Fix decrementing a borrowed reference in tracemalloc. (#2747) X-Git-Tag: v3.7.0a1~407 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ed5ad79ec6c6270e6018bd0a55656305ee60907;p=python bpo-30961: Fix decrementing a borrowed reference in tracemalloc. (#2747) --- diff --git a/Misc/NEWS.d/next/Library/2017-07-18-23-47-51.bpo-30961.064jz0.rst b/Misc/NEWS.d/next/Library/2017-07-18-23-47-51.bpo-30961.064jz0.rst new file mode 100644 index 0000000000..b89c6d4769 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-07-18-23-47-51.bpo-30961.064jz0.rst @@ -0,0 +1 @@ +Fix decrementing a borrowed reference in tracemalloc. diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 00d3542409..d9833362dd 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -1752,7 +1752,7 @@ _PyTraceMalloc_Init(void) if (key == NULL) return -1; - value = PyDict_GetItemWithError(xoptions, key); + value = PyDict_GetItemWithError(xoptions, key); /* borrowed */ Py_DECREF(key); if (value == NULL) { if (PyErr_Occurred()) @@ -1763,7 +1763,6 @@ _PyTraceMalloc_Init(void) } nframe = parse_sys_xoptions(value); - Py_DECREF(value); if (nframe < 0) { Py_FatalError("-X tracemalloc=NFRAME: invalid number of frames"); }