Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a80b14c

Browse files
committed
- Issue #13021: Missing decref on an error path. Thanks to Suman Saha for
finding the bug and providing a patch.
2 parents 225aa4f + 916048d commit a80b14c

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

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.3 Alpha 1?
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
@@ -1251,8 +1251,10 @@ PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit,
12511251
Py_DECREF(f);
12521252
return -1;
12531253
}
1254-
if (PyDict_SetItemString(d, "__cached__", Py_None) < 0)
1254+
if (PyDict_SetItemString(d, "__cached__", Py_None) < 0) {
1255+
Py_DECREF(f);
12551256
return -1;
1257+
}
12561258
set_file_name = 1;
12571259
Py_DECREF(f);
12581260
}

0 commit comments

Comments
 (0)