RTOS: Unify wipe-out of thread list 16/1916/8
authorChristian Eggers <ceggers@gmx.de>
Sat, 1 Feb 2014 09:17:17 +0000 (10:17 +0100)
committerSpencer Oliver <spen@spen-soft.co.uk>
Tue, 4 Mar 2014 20:13:58 +0000 (20:13 +0000)
commitd36889e692788d4dc4acabd073d57f4a178e3172
treedda4f27bdc4781a69a905195a68c6ef0ec4d5c7a
parentbc1340cf0b9aa28c03d1b07c54b6e0bf4a483351
RTOS: Unify wipe-out of thread list

Each RTOS implementation uses it's own (similar) code to free
the thread list. There are some additional issues:

<--->
if (pointer != NULL)
free(pointer);
<--->
This is not necessary, free(NULL) is perfectly ok.

<--->
free(rtos->thread_details);
rtos->thread_details = NULL;
rtos->thread_count = 0;
<--->
The 3rd line has been missing for all RTOS but ChibiOs. There are paths
in the code where rtos->thread_count is never set to NULL, which can
lead to null pointer dereference of rtos->thread_details.

Change-Id: I6f7045c3d4518b925cb80dd5c907a566536b34ad
Signed-off-by: Christian Eggers <ceggers@gmx.de>
---
Changelog:
v7:
- rtos_wipe_threadlist() --> rtos_free_threadlist()
- removed non related changes in gdb_server.c from this patch
v3:
- Removed world "topic" from first line of commit message
v2:
- typo: "whipe" --> "wipe"
Reviewed-on: http://openocd.zylin.com/1916
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/rtos/ChibiOS.c
src/rtos/FreeRTOS.c
src/rtos/ThreadX.c
src/rtos/eCos.c
src/rtos/embKernel.c
src/rtos/rtos.c
src/rtos/rtos.h

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)