Skip to content

Commit ef86368

Browse files
committed
Fix possible NULL pointer dereference in PyCurses_Start_Color()
CID 1058276
2 parents 5d7c1b1 + a956e64 commit ef86368

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Modules/_cursesmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2926,9 +2926,13 @@ PyCurses_Start_Color(PyObject *self)
29262926
if (code != ERR) {
29272927
initialisedcolors = TRUE;
29282928
c = PyLong_FromLong((long) COLORS);
2929+
if (c == NULL)
2930+
return NULL;
29292931
PyDict_SetItemString(ModDict, "COLORS", c);
29302932
Py_DECREF(c);
29312933
cp = PyLong_FromLong((long) COLOR_PAIRS);
2934+
if (cp == NULL)
2935+
return NULL;
29322936
PyDict_SetItemString(ModDict, "COLOR_PAIRS", cp);
29332937
Py_DECREF(cp);
29342938
Py_INCREF(Py_None);

0 commit comments

Comments
 (0)