]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Initialize variable in py_get_event_thread
authorSimon Marchi <simon.marchi@polymtl.ca>
Sat, 25 Aug 2018 15:52:24 +0000 (11:52 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Sat, 25 Aug 2018 15:52:24 +0000 (11:52 -0400)
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.

gdb/ChangeLog
gdb/python/py-threadevent.c

index 12dda6c541d94a8dd3ecd840f3757bfade2c618c..9e3d6bc27acdad8f18f488de4245c2eaa567f8f8 100644 (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>
 
        * python/py-bpevent.c (create_breakpoint_event_object): Use
index a78f0a38310c19512dde46a30519050076baf11e..4f822b4ae09c03c4eef9baf621fe9f2fb112fc90 100644 (file)
@@ -25,7 +25,7 @@
 PyObject *
 py_get_event_thread (ptid_t ptid)
 {
-  PyObject *pythread;
+  PyObject *pythread = nullptr;
 
   if (non_stop)
     {
@@ -36,7 +36,7 @@ py_get_event_thread (ptid_t ptid)
   else
     pythread = Py_None;
 
-  if (!pythread)
+  if (pythread == nullptr)
     {
       PyErr_SetString (PyExc_RuntimeError, "Could not find event thread");
       return NULL;