This is an automated email from Gerrit.

Antonio Borneo ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/6005

-- gerrit

commit 4f0cf45a1ad8ed50c2064f06a4b88bda25791ffc
Author: Antonio Borneo <[email protected]>
Date:   Mon Jan 4 19:24:21 2021 +0100

    target: fix memory leak on multiple '-gdb-port' flag
    
    In the odd case of multiple flags '-gdb-port' during 'target
    create' or following 'configure', the new strdup()'ed value will
    replace the old one without freeing it.
    
    Free the old value (if it exists) before replacing it.
    
    Change-Id: I1673346613ce7023880046e3a9ba473e75f18b8a
    Signed-off-by: Antonio Borneo <[email protected]>

diff --git a/src/target/target.c b/src/target/target.c
index 3c1a633..c752844 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5123,6 +5123,7 @@ no_params:
                                e = Jim_GetOpt_String(goi, &s, NULL);
                                if (e != JIM_OK)
                                        return e;
+                               free(target->gdb_port_override);
                                target->gdb_port_override = strdup(s);
                        } else {
                                if (goi->argc != 0)

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to