[Python-checkins] r42886 - python/branches/release24-maint/Modules/_curses_panel.c

thomas.wouters python-checkins at python.org
Tue Mar 7 14:39:26 CET 2006


Author: thomas.wouters
Date: Tue Mar  7 14:39:26 2006
New Revision: 42886

Modified:
   python/branches/release24-maint/Modules/_curses_panel.c
Log:

Backport trunk's r42885 (thomas.wouters):

Coverity-found bug: don't use temp->next *before* checking it for NULL. Also
return rather than use it again.



Modified: python/branches/release24-maint/Modules/_curses_panel.c
==============================================================================
--- python/branches/release24-maint/Modules/_curses_panel.c	(original)
+++ python/branches/release24-maint/Modules/_curses_panel.c	Tue Mar  7 14:39:26 2006
@@ -111,10 +111,12 @@
 	free(temp);
 	return;
     }
-    while (temp->next->po != po) {
-	if (temp->next == NULL)
+    while (temp->next == NULL || temp->next->po != po) {
+	if (temp->next == NULL) {
 	    PyErr_SetString(PyExc_RuntimeError,
 			    "remove_lop: can't find Panel Object");
+	    return;
+	}
 	temp = temp->next;
     }
     n = temp->next->next;


More information about the Python-checkins mailing list