mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
Issue #14761: Fix potential leak on an error case in the import machinery.
This commit is contained in:
parent
b98b37f101
commit
d576c711a5
3 changed files with 5 additions and 1 deletions
|
@ -1293,7 +1293,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
|
|||
FILE *fpc;
|
||||
char *buf;
|
||||
char *cpathname;
|
||||
PyCodeObject *co;
|
||||
PyCodeObject *co = NULL;
|
||||
PyObject *m;
|
||||
|
||||
if (fstat(fileno(fp), &st) != 0) {
|
||||
|
@ -1350,6 +1350,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
|
|||
return m;
|
||||
|
||||
error_exit:
|
||||
Py_XDECREF(co);
|
||||
PyMem_FREE(buf);
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue