This is an automated email from Gerrit.

"Tomas Vanek <[email protected]>" just uploaded a new patch set to Gerrit, which 
you can find at https://review.openocd.org/c/openocd/+/6685

-- gerrit

commit 2938118bca527e7fa2ce1c93039298942b47d943
Author: Tomas Vanek <[email protected]>
Date:   Wed Nov 10 12:46:42 2021 +0100

    target/arm_dap: fix memory leak in error path of dap_create()
    
    Change-Id: I91fa5910670161b62a76fc834b6394c5a6c05395
    Suggested-by: Antonio Borneo <[email protected]>
    Signed-off-by: Tomas Vanek <[email protected]>

diff --git a/src/target/arm_dap.c b/src/target/arm_dap.c
index 968cb9659..6dd35f695 100644
--- a/src/target/arm_dap.c
+++ b/src/target/arm_dap.c
@@ -319,8 +319,11 @@ static int dap_create(struct jim_getopt_info *goi)
                dap_commands[0].chain = NULL;
 
        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;
+       }
 
        list_add_tail(&dap->lh, &all_dap);
 

-- 

Reply via email to