diff options
author | Marc Schink <dev@zapb.de> | 2020-02-27 13:48:15 +0100 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2020-03-17 16:40:14 +0000 |
commit | aff486b6a05e1413520537d0d257e36e433754fd (patch) | |
tree | 5bd258071d957e6d0ec388c167bbdd7269f9efbe /src/target/target.c | |
parent | dca1c6ca1f78a6a89e4274e409ff822d655add6b (diff) | |
download | riscv-openocd-aff486b6a05e1413520537d0d257e36e433754fd.zip riscv-openocd-aff486b6a05e1413520537d0d257e36e433754fd.tar.gz riscv-openocd-aff486b6a05e1413520537d0d257e36e433754fd.tar.bz2 |
rtos: Destroy RTOS and fix memory leak
The memory leak can be reproduced by using an arbitrary RTOS
and valgrind:
$ valgrind --leak-check=full --show-leak-kinds=all
[...]
==9656== 224 (80 direct, 144 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 3
==9656== at 0x483CD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==9656== by 0x1C541A: os_alloc (rtos.c:79)
==9656== by 0x1C569E: os_alloc_create (rtos.c:111)
==9656== by 0x1C569E: rtos_create (rtos.c:153)
==9656== by 0x1AE332: target_configure (target.c:4899)
==9656== by 0x1AF228: jim_target_configure (target.c:4952)
==9656== by 0x1C9EF9: command_unknown (command.c:1066)
==9656== by 0x313284: JimInvokeCommand (jim.c:10364)
==9656== by 0x313FB6: Jim_EvalObj (jim.c:10814)
==9656== by 0x3154A3: Jim_EvalFile (jim.c:11207)
==9656== by 0x316015: Jim_SourceCoreCommand (jim.c:15230)
==9656== by 0x313284: JimInvokeCommand (jim.c:10364)
==9656== by 0x313B8B: JimEvalObjList (jim.c:10605)
[...]
Change-Id: I2cd41a154fb8570842601ff4e3e76502f5908f49
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5479
Tested-by: jenkins
Reviewed-by: Moritz Fischer <moritzf@google.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/target/target.c')
-rw-r--r-- | src/target/target.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/target/target.c b/src/target/target.c index ceecaee..b77400c 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2049,6 +2049,8 @@ static void target_destroy(struct target *target) target->smp = 0; } + rtos_destroy(target); + free(target->gdb_port_override); free(target->type); free(target->trace_info); |