This is an automated email from Gerrit.

Spencer Oliver ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/1555

-- gerrit

commit 338b3aa1279fda63bab52d1b8ba5ea58970e4a30
Author: Spencer Oliver <[email protected]>
Date:   Fri Aug 16 16:07:20 2013 +0100

    rtos: Do not dereference null pointers
    
    detected by clang.
    
    Change-Id: Id395f9d33bc2903b29a158fc3540ae51857e6aa0
    Signed-off-by: Spencer Oliver <[email protected]>

diff --git a/src/rtos/linux.c b/src/rtos/linux.c
index 80d84d7..61be775 100644
--- a/src/rtos/linux.c
+++ b/src/rtos/linux.c
@@ -533,7 +533,7 @@ int get_current(struct target *target, int create)
                                        LOG_ERROR
                                                ("error in linux current thread 
update");
 
-                               if (create) {
+                               if (create && ct != NULL) {
                                        struct threads *t;
                                        t = calloc(1, sizeof(struct threads));
                                        t->base_addr = ct->TS;
@@ -1140,8 +1140,11 @@ int linux_gdb_thread_packet(struct target *target,
        char *tmp_str = out_str;
        tmp_str += sprintf(tmp_str, "m");
        struct threads *temp = linux_os->thread_list;
-       tmp_str += sprintf(tmp_str, "%016" PRIx64, temp->threadid);
-       temp = temp->next;
+
+       if (temp != NULL) {
+               tmp_str += sprintf(tmp_str, "%016" PRIx64, temp->threadid);
+               temp = temp->next;
+       }
 
        while (temp != NULL) {
                tmp_str += sprintf(tmp_str, ",");

-- 

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to