Skip to content

Commit e4fa631

Browse files
committed
Fix refleak in _cursesmodule.c
1 parent 577de24 commit e4fa631

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Modules/_cursesmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,7 @@ _curses_window_addstr_impl(PyCursesWindowObject *self, int group_left_1,
11121112
attr_old = getattrs(self->win);
11131113
if (curses_wattrset(self, attr, "addstr") < 0) {
11141114
curses_release_wstr(strtype, wstr);
1115+
Py_DECREF(bytesobj);
11151116
return NULL;
11161117
}
11171118
}
@@ -1210,6 +1211,7 @@ _curses_window_addnstr_impl(PyCursesWindowObject *self, int group_left_1,
12101211
attr_old = getattrs(self->win);
12111212
if (curses_wattrset(self, attr, "addnstr") < 0) {
12121213
curses_release_wstr(strtype, wstr);
1214+
Py_DECREF(bytesobj);
12131215
return NULL;
12141216
}
12151217
}
@@ -2212,6 +2214,7 @@ _curses_window_insstr_impl(PyCursesWindowObject *self, int group_left_1,
22122214
attr_old = getattrs(self->win);
22132215
if (curses_wattrset(self, attr, "insstr") < 0) {
22142216
curses_release_wstr(strtype, wstr);
2217+
Py_DECREF(bytesobj);
22152218
return NULL;
22162219
}
22172220
}

0 commit comments

Comments
 (0)