mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
bpo-43108: Fix a reference leak in the curses module (GH-24420)
This commit is contained in:
parent
01c4fddc4b
commit
bb739ec922
2 changed files with 4 additions and 1 deletions
|
|
@ -0,0 +1 @@
|
||||||
|
Fixed a reference leak in the :mod:`curses` module. Patch by Pablo Galindo
|
||||||
|
|
@ -388,6 +388,7 @@ PyCurses_ConvertToString(PyCursesWindowObject *win, PyObject *obj,
|
||||||
*bytes = obj;
|
*bytes = obj;
|
||||||
/* check for embedded null bytes */
|
/* check for embedded null bytes */
|
||||||
if (PyBytes_AsStringAndSize(*bytes, &str, NULL) < 0) {
|
if (PyBytes_AsStringAndSize(*bytes, &str, NULL) < 0) {
|
||||||
|
Py_DECREF(obj);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -828,8 +829,9 @@ _curses_window_addstr_impl(PyCursesWindowObject *self, int group_left_1,
|
||||||
#else
|
#else
|
||||||
strtype = PyCurses_ConvertToString(self, str, &bytesobj, NULL);
|
strtype = PyCurses_ConvertToString(self, str, &bytesobj, NULL);
|
||||||
#endif
|
#endif
|
||||||
if (strtype == 0)
|
if (strtype == 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
if (use_attr) {
|
if (use_attr) {
|
||||||
attr_old = getattrs(self->win);
|
attr_old = getattrs(self->win);
|
||||||
(void)wattrset(self->win,attr);
|
(void)wattrset(self->win,attr);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue