Skip to content

Commit

Permalink
bpo-30961: Fix decrementing a borrowed reference in tracemalloc. (#2747
Browse files Browse the repository at this point in the history
…) (#2749)

(cherry picked from commit 4ed5ad7)
  • Loading branch information
zhangyangyu authored Jul 18, 2017
1 parent 45c471c commit cb3f024
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix decrementing a borrowed reference in tracemalloc.
3 changes: 1 addition & 2 deletions Modules/_tracemalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,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())
Expand All @@ -1419,7 +1419,6 @@ _PyTraceMalloc_Init(void)
}

nframe = parse_sys_xoptions(value);
Py_DECREF(value);
if (nframe < 0) {
Py_FatalError("-X tracemalloc=NFRAME: invalid number of frames");
}
Expand Down

0 comments on commit cb3f024

Please sign in to comment.