Initialize variable in py_get_event_thread

The pythread variable could be used without being initialized, fix it by
initializing it to nullptr.

gdb/ChangeLog:

	* python/py-threadevent.c (py_get_event_thread): Initialize
	pythread.
This commit is contained in:
Simon Marchi 2018-08-25 11:52:24 -04:00
parent 7a815dd566
commit bbbbbceebc
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2018-08-25 Simon Marchi <simon.marchi@polymtl.ca>
* python/py-threadevent.c (py_get_event_thread): Initialize
pythread.
2018-08-24 Pedro Alves <palves@redhat.com> 2018-08-24 Pedro Alves <palves@redhat.com>
* python/py-bpevent.c (create_breakpoint_event_object): Use * python/py-bpevent.c (create_breakpoint_event_object): Use

View file

@ -25,7 +25,7 @@
PyObject * PyObject *
py_get_event_thread (ptid_t ptid) py_get_event_thread (ptid_t ptid)
{ {
PyObject *pythread; PyObject *pythread = nullptr;
if (non_stop) if (non_stop)
{ {
@ -36,7 +36,7 @@ py_get_event_thread (ptid_t ptid)
else else
pythread = Py_None; pythread = Py_None;
if (!pythread) if (pythread == nullptr)
{ {
PyErr_SetString (PyExc_RuntimeError, "Could not find event thread"); PyErr_SetString (PyExc_RuntimeError, "Could not find event thread");
return NULL; return NULL;