This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] linux-thread-db, check return value of find_thread_pid
- From: msnyder at sonic dot net
- To: gdb-patches at sourceware dot org
- Date: Thu, 28 Jun 2007 15:35:27 -0700 (PDT)
- Subject: [patch] linux-thread-db, check return value of find_thread_pid
May return null, check before using.
2007-06-28 Michael Snyder <msnyder@access-company.com>
* linux-thread-db.c (thread_db_get_thread_local_address): Add
gdb_assert before using return value of find_thread_pid (Coverity).
Index: linux-thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-thread-db.c,v
retrieving revision 1.32
diff -p -r1.32 linux-thread-db.c
*** linux-thread-db.c 27 Jun 2007 11:52:02 -0000 1.32
--- linux-thread-db.c 28 Jun 2007 22:31:48 -0000
*************** thread_db_get_thread_local_address (ptid
*** 1081,1086 ****
--- 1081,1087 ----
/* Get info about the thread. */
thread_info = find_thread_pid (ptid);
+ gdb_assert (thread_info);
thread_db_map_id2thr (thread_info, 1);
/* Finally, get the address of the variable. */