helper/command: make command_run_line reentrant
authorChristopher Head <chead@zaber.com>
Fri, 7 Jun 2019 18:40:25 +0000 (11:40 -0700)
committerTomas Vanek <vanekt@fbl.cz>
Thu, 20 Jun 2019 18:50:22 +0000 (19:50 +0100)
commit77a8914b7f960a304406ba4fd39b410c50f25be8
tree13fe02d3e71ae0177b067c7f3e18d7bd3fd3bae8
parent23b6aa9bf864d8e8648394b72f62611f442cc6d0
helper/command: make command_run_line reentrant

The `command_run_line` function contains a comment saying it should be
reentrant. However, it isn’t: it NULLs out `current_target_override` and
doesn’t restore it before returning, and it changes the `context`
associated data of the `interp` object and then deletes that associated
data before returning rather than restoring it to its previous value.

Change-Id: I84fd46ef7173f08cf7c57b9a5b76e4986a60816f
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/5223
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
src/helper/command.c