Fix possible NULL pointer dereference in PyCurses_Start_Color()
CID 1058276
This commit is contained in:
parent
845f7845aa
commit
a956e645c1
|
@ -2930,9 +2930,13 @@ PyCurses_Start_Color(PyObject *self)
|
||||||
if (code != ERR) {
|
if (code != ERR) {
|
||||||
initialisedcolors = TRUE;
|
initialisedcolors = TRUE;
|
||||||
c = PyLong_FromLong((long) COLORS);
|
c = PyLong_FromLong((long) COLORS);
|
||||||
|
if (c == NULL)
|
||||||
|
return NULL;
|
||||||
PyDict_SetItemString(ModDict, "COLORS", c);
|
PyDict_SetItemString(ModDict, "COLORS", c);
|
||||||
Py_DECREF(c);
|
Py_DECREF(c);
|
||||||
cp = PyLong_FromLong((long) COLOR_PAIRS);
|
cp = PyLong_FromLong((long) COLOR_PAIRS);
|
||||||
|
if (cp == NULL)
|
||||||
|
return NULL;
|
||||||
PyDict_SetItemString(ModDict, "COLOR_PAIRS", cp);
|
PyDict_SetItemString(ModDict, "COLOR_PAIRS", cp);
|
||||||
Py_DECREF(cp);
|
Py_DECREF(cp);
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
|
Loading…
Reference in New Issue