FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.15] gh-159739: Release resources on interpreter startup error paths (GH-159752) by miss-islington · Pull Request #159793 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (2) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix memory leaks during interpreter startup when a path configuration file is
empty or too large, or when an audit hook rejects a command.
2 changes: 2 additions & 0 deletions Modules/getpath.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,11 @@ getpath_readlines(PyObject *Py_UNUSED(self), PyObject *args)
size_t cb = fread(buffer, 1, MAX_FILE, fp);
fclose(fp);
if (!cb) {
PyMem_Free(buffer);
return r;
}
if (cb >= MAX_FILE) {
PyMem_Free(buffer);
Py_DECREF(r);
PyErr_SetString(PyExc_MemoryError,
"cannot read file larger than 32KB during initialization");
Expand Down
1 change: 1 addition & 0 deletions Modules/main.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ pymain_run_command(wchar_t *command)
}

if (PySys_Audit("cpython.run_command", "O", unicode) < 0) {
Py_DECREF(unicode);
return pymain_exit_err_print();
}

Expand Down
Loading

Back | FazBrowse Home | New Git URL