Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix a memory leak in the curses module when setupterm() is called before
initscr(), where the previously allocated terminal state was not freed.
5 changes: 4 additions & 1 deletion Modules/_cursesmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3731,7 +3731,10 @@ _curses_initscr_impl(PyObject *module)
}
return PyCursesWindow_New(state, stdscr, NULL, NULL);
}

if (cur_term != NULL) {
del_curterm(cur_term);
cur_term = NULL;
}
win = initscr();

if (win == NULL) {
Expand Down
Loading