diff Modules/_cursesmodule.c @ 84829:aedcf7ef8489 3.3

Fix possible NULL pointer dereference in PyCurses_Start_Color() CID 1058276
author Christian Heimes <christian@cheimes.de>
date Fri, 26 Jul 2013 14:45:37 +0200
parents e2e104ba42ff
children 3c5bf0c7a290
line wrap: on
line diff
--- a/Modules/_cursesmodule.c	Thu Jul 25 17:34:00 2013 -0400
+++ b/Modules/_cursesmodule.c	Fri Jul 26 14:45:37 2013 +0200
@@ -2930,9 +2930,13 @@
     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);