openocd/src/helper
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
..
Makefile.am ioutil: drop the code, deprecated in v0.10.0 2021-03-19 21:55:23 +00:00
bin2char.sh helper: fix minor typos 2020-09-05 17:10:54 +01:00
binarybuffer.c Fix debug prints when loading to flash 2020-09-05 16:48:08 +01:00
binarybuffer.h Fix debug prints when loading to flash 2020-09-05 16:48:08 +01:00
bits.h openocd: fix incorrect doxygen comments 2021-01-13 11:33:16 +00:00
command.c jimtcl: add temporary workaround for memory leak in jimtcl 0.80 2021-04-05 23:24:30 +01:00
command.h helper: fix minor typos 2020-09-05 17:10:54 +01:00
configuration.c helper/configuration: free script_search_dirs and config_file_names 2018-03-07 23:47:31 +00:00
configuration.h helper/configuration: free script_search_dirs and config_file_names 2018-03-07 23:47:31 +00:00
fileio.c Handle improperly build image files gracefully 2018-02-14 08:27:01 +00:00
fileio.h Handle improperly build image files gracefully 2018-02-14 08:27:01 +00:00
jep106.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
jep106.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
jep106.inc jep106: Add new IDs from JEDEC 2020-12-05 23:17:48 +00:00
jim-nvp.c jim-nvp: Make Jim_GetOpt_String const-correct 2016-02-29 20:32:31 +00:00
jim-nvp.h helper: fix minor typos 2020-09-05 17:10:54 +01:00
list.h openocd: fix incorrect doxygen comments 2021-01-13 11:33:16 +00:00
log.c helper: fix minor typos 2020-09-05 17:10:54 +01:00
log.h Upstream tons of RISC-V changes. 2020-10-14 05:43:05 +01:00
options.c openocd: remove command line flag -p/--pipe deprecated in v0.5.0 2021-03-19 21:54:46 +00:00
replacements.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
replacements.h helper/replacements.h: Add missing #include 2018-03-07 23:43:58 +00:00
startup.tcl coding style: src: remove empty lines at end of text files 2020-05-02 15:40:21 +01:00
system.h configure: drop macro 'AC_HEADER_TIME' 2021-01-18 15:32:46 +00:00
time_support.c Add timeval_compare helper function 2018-01-25 16:43:45 +00:00
time_support.h configure: drop macro 'AC_HEADER_TIME' 2021-01-18 15:32:46 +00:00
time_support_common.c Fix usage of timeval_ms() 2016-07-19 10:45:16 +01:00
types.h Remove BUILD_TARGET64 2020-04-21 12:55:41 +01:00
update_jep106.pl helper: fix minor typos 2020-09-05 17:10:54 +01:00
util.c helper: fix minor typos 2020-09-05 17:10:54 +01:00
util.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00