Skip to content

Commit 916048d

Browse files
committed
- Issue #13021: Missing decref on an error path. Thanks to Suman Saha for
finding the bug and providing a patch.
1 parent c0420fd commit 916048d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ What's New in Python 3.2.3?
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #13021: Missing decref on an error path. Thanks to Suman Saha for
14+
finding the bug and providing a patch.
15+
1316
- Issue #12973: Fix overflow check that relied on undefined behaviour in
1417
list_repeat. This bug caused test_list to fail with recent versions
1518
of Clang.

Python/pythonrun.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,8 +1241,10 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit,
12411241
Py_DECREF(f);
12421242
return -1;
12431243
}
1244-
if (PyDict_SetItemString(d, "__cached__", Py_None) < 0)
1244+
if (PyDict_SetItemString(d, "__cached__", Py_None) < 0) {
1245+
Py_DECREF(f);
12451246
return -1;
1247+
}
12461248
set_file_name = 1;
12471249
Py_DECREF(f);
12481250
}

0 commit comments

Comments
 (0)