openocd/src
Antonio Borneo 36ae487ed0 jimtcl: add temporary workaround for memory leak in jimtcl 0.80
The API Jim_CreateCommand() in latest version of jimtcl leaks the
memory allocated internally by jimtcl when it converts the string
command-name to a Jim_Obj.
The fix is already merged upstream and would be available in next
jimtcl 0.81, expected in ~6 months, hopefully before the next tag
for OpenOCD v0.12.0.
OpenOCD v0.11.0 is distributed with jimtcl 0.79.
Debian distributes jimtcl as a separate library package and today
it's still on 0.79.

It make sense to keep using jimtcl 0.80 in current development
cycle to test it further. But having this background memory leak
noise hides the eventual new memory leaks that could come from the
development activity.

This patch uses the internal jimtcl API Jim_CreateCommandObj() and
correctly free the internal object, avoiding the memory leak.
Being an internal API, it is not accessible if OpenOCD is linked
with an external jimtcl library. Nevertheless, building jimtcl as
a submodule of OpenOCD makes the trick effective.

The scope of this patch is thus limited at developers that build
OpenOCD with jimtcl submodule and need to control and debug memory
leaks.
This patch is supposed to be removed as soon as jimtcl 0.81 gets
available.

The added code is located, on purpose, in an area of the file that
hopefully will not conflict other patches pending in gerrit.

Change-Id: I4d300ad21bdb6c616c3f0f14b429b4fdf360900d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6130
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
2021-04-05 23:24:30 +01:00
..
flash flash/stm32l4x: probe tzen and rdp values 2021-03-24 17:18:29 +00:00
helper jimtcl: add temporary workaround for memory leak in jimtcl 0.80 2021-04-05 23:24:30 +01:00
jtag drivers: USB Blaster II: close file and release USB device if firmware handling failed 2021-03-19 22:01:54 +00:00
pld openocd: use proper format with uint32_t 2020-09-05 17:12:44 +01:00
rtos rtos: Remove typedef'd struct 2021-03-10 21:29:52 +00:00
rtt openocd: fix doxygen parameters of functions 2021-01-13 11:33:53 +00:00
server telnet: support end and home keys 2021-03-19 21:58:59 +00:00
svf openocd: fix command's usage string 2020-09-05 17:13:10 +01:00
target target/arc: refactor ARC register numbers defines 2021-03-19 22:01:00 +00:00
transport jtag: remove minidriver code and minidriver-dummy 2021-03-19 21:56:06 +00:00
xsvf openocd: avoid checking for non NULL pointer to free it 2020-09-05 17:11:50 +01:00
hello.c helper/command: change prototype of command_print/command_print_sameline 2019-05-14 19:37:11 +01:00
hello.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
main.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
Makefile.am build: Fix out-of-tree with --disable-dependency-tracking configure flag 2021-04-05 23:24:14 +01:00
openocd.c ioutil: drop the code, deprecated in v0.10.0 2021-03-19 21:55:23 +00:00
openocd.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00