From 35d9bf9917fc9c00a6b8e941a5479e85878ef33c Mon Sep 17 00:00:00 2001 From: Tomas Vanek Date: Fri, 20 Dec 2019 23:38:42 +0100 Subject: [PATCH] xsvf: fix memory leak Discovered by clang static analyzer. Change-Id: I2980586aea5ee43226adb1f4cf72e7ba1dfddd83 Signed-off-by: Tomas Vanek Reviewed-on: http://openocd.zylin.com/5372 Tested-by: jenkins Reviewed-by: Oleksij Rempel --- src/xsvf/xsvf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xsvf/xsvf.c b/src/xsvf/xsvf.c index e574c6f0e..bec32f21e 100644 --- a/src/xsvf/xsvf.c +++ b/src/xsvf/xsvf.c @@ -918,8 +918,10 @@ COMMAND_HANDLER(handle_xsvf_command) struct scan_field field; result = svf_add_statemove(loop_state); - if (result != ERROR_OK) + if (result != ERROR_OK) { + free(dr_in_mask); return result; + } jtag_add_clocks(loop_clocks); jtag_add_sleep(loop_usecs);