summaryrefslogtreecommitdiff
path: root/Modules/_cursesmodule.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-26 14:45:37 +0200
committerChristian Heimes <christian@cheimes.de>2013-07-26 14:45:37 +0200
commita956e645c10051cada87abc90248b112df7e1974 (patch)
tree6226355902e0cd2411f9560697d3c276a37f0362 /Modules/_cursesmodule.c
parent845f7845aa6493b59a3b3c427ae85fcd42f58d16 (diff)
downloadcpython-git-a956e645c10051cada87abc90248b112df7e1974.tar.gz
Fix possible NULL pointer dereference in PyCurses_Start_Color()
CID 1058276
Diffstat (limited to 'Modules/_cursesmodule.c')
-rw-r--r--Modules/_cursesmodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 132670d548..f5df80c746 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2930,9 +2930,13 @@ PyCurses_Start_Color(PyObject *self)
if (code != ERR) {
initialisedcolors = TRUE;
c = PyLong_FromLong((long) COLORS);
+ if (c == NULL)
+ return NULL;
PyDict_SetItemString(ModDict, "COLORS", c);
Py_DECREF(c);
cp = PyLong_FromLong((long) COLOR_PAIRS);
+ if (cp == NULL)
+ return NULL;
PyDict_SetItemString(ModDict, "COLOR_PAIRS", cp);
Py_DECREF(cp);
Py_INCREF(Py_None);