xsvf: fix memory leak 72/5372/2
authorTomas Vanek <vanekt@fbl.cz>
Fri, 20 Dec 2019 22:38:42 +0000 (23:38 +0100)
committerTomas Vanek <vanekt@fbl.cz>
Thu, 16 Jan 2020 09:44:33 +0000 (09:44 +0000)
Discovered by clang static analyzer.

Change-Id: I2980586aea5ee43226adb1f4cf72e7ba1dfddd83
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5372
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
src/xsvf/xsvf.c

index e574c6f..bec32f2 100644 (file)
@@ -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);