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

Skip to content

Commit d576c71

Browse files
committed
Issue #14761: Fix potential leak on an error case in the import machinery.
1 parent b98b37f commit d576c71

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ Tony Campbell
145145
Brett Cannon
146146
Mike Carlton
147147
Terry Carroll
148+
Damien Cassou
148149
Lorenzo M. Catucci
149150
Donn Cave
150151
Charles Cazabon

Misc/NEWS

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

13+
- Issue #14761: Fix potential leak on an error case in the import machinery.
14+
1315
- Issue #14699: Fix calling the classmethod descriptor directly.
1416

1517
- Issue #14433: Prevent msvcrt crash in interactive prompt when stdin

Python/import.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
12931293
FILE *fpc;
12941294
char *buf;
12951295
char *cpathname;
1296-
PyCodeObject *co;
1296+
PyCodeObject *co = NULL;
12971297
PyObject *m;
12981298

12991299
if (fstat(fileno(fp), &st) != 0) {
@@ -1350,6 +1350,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
13501350
return m;
13511351

13521352
error_exit:
1353+
Py_XDECREF(co);
13531354
PyMem_FREE(buf);
13541355
return NULL;
13551356
}

0 commit comments

Comments
 (0)