diff options
author | Thomas Wouters <thomas@python.org> | 2006-03-07 13:38:14 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2006-03-07 13:38:14 (GMT) |
commit | 47f003d326f4e30a17cf9d91e384e98e7367533a (patch) | |
tree | a0b023e7712db287c6bc1e252a20f3b561902daf /Modules | |
parent | 622927b8502b0d638d52a65d6c03f4d822616b11 (diff) | |
download | cpython-47f003d326f4e30a17cf9d91e384e98e7367533a.zip cpython-47f003d326f4e30a17cf9d91e384e98e7367533a.tar.gz cpython-47f003d326f4e30a17cf9d91e384e98e7367533a.tar.bz2 |
Coverity-found bug: don't use temp->next *before* checking it for NULL. Also
return rather than use it again.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_curses_panel.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_curses_panel.c b/Modules/_curses_panel.c index c3f313a..0acf3fd 100644 --- a/Modules/_curses_panel.c +++ b/Modules/_curses_panel.c @@ -111,10 +111,12 @@ remove_lop(PyCursesPanelObject *po) 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; |