This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Initialize variable in py_get_event_thread


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bbbbbceebc342d583057a11d88bae85f451cd904

commit bbbbbceebc342d583057a11d88bae85f451cd904
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Sat Aug 25 11:52:24 2018 -0400

    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.

Diff:
---
 gdb/ChangeLog               | 5 +++++
 gdb/python/py-threadevent.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 12dda6c..9e3d6bc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/python/py-threadevent.c b/gdb/python/py-threadevent.c
index a78f0a3..4f822b4 100644
--- a/gdb/python/py-threadevent.c
+++ b/gdb/python/py-threadevent.c
@@ -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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]