target/arm_dap: fix memory leak in error path of dap_create()
Change-Id: I91fa5910670161b62a76fc834b6394c5a6c05395 Suggested-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6685 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
parent
08dac883a1
commit
3eef83e4bd
|
@ -267,8 +267,11 @@ static int dap_create(struct jim_getopt_info *goi)
|
||||||
dap_commands[0].chain = NULL;
|
dap_commands[0].chain = NULL;
|
||||||
|
|
||||||
e = register_commands_with_data(cmd_ctx, NULL, dap_commands, dap);
|
e = register_commands_with_data(cmd_ctx, NULL, dap_commands, dap);
|
||||||
if (e != ERROR_OK)
|
if (e != ERROR_OK) {
|
||||||
|
free(dap->name);
|
||||||
|
free(dap);
|
||||||
return JIM_ERR;
|
return JIM_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
list_add_tail(&dap->lh, &all_dap);
|
list_add_tail(&dap->lh, &all_dap);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue