From 965730dda9e1bbb18b9b954ef63ce9ed22fef73f Mon Sep 17 00:00:00 2001 From: Daniel Anselmi Date: Mon, 10 Jul 2023 21:03:10 +0200 Subject: [PATCH] ipdbg: fix 'double free' in case of failed start Change-Id: Id241d9dd0793095106fea000422617fbef462669 Signed-off-by: Daniel Anselmi Reviewed-on: https://review.openocd.org/c/openocd/+/7770 Reviewed-by: Antonio Borneo Tested-by: jenkins --- src/server/ipdbg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/server/ipdbg.c b/src/server/ipdbg.c index 3fae0a98d..c1bdb2939 100644 --- a/src/server/ipdbg.c +++ b/src/server/ipdbg.c @@ -632,10 +632,8 @@ static int ipdbg_start(uint16_t port, struct jtag_tap *tap, uint32_t user_instru } } else { int retval = ipdbg_create_hub(tap, user_instruction, data_register_length, virtual_ir, &hub); - if (retval != ERROR_OK) { - free(virtual_ir); + if (retval != ERROR_OK) return retval; - } } struct ipdbg_service *service = NULL;