This is an automated email from Gerrit.

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

-- gerrit

commit f0416db46014364d5061b4e48452fa027a4c9c6a
Author: Antonio Borneo <[email protected]>
Date:   Tue Oct 7 12:14:15 2025 +0200

    target: riscv: fix double free() in parse_reg_ranges()
    
    The buffer 'args' is allocated and freed in the caller function
    parse_reg_ranges().
    There is no reason to free it, only in some special case, in the
    called function parse_reg_ranges_impl().
    Scan build reports:
            src/target/riscv/riscv.c:4537:2: warning: Attempt to free
            released memory [unix.Malloc]
    
    Drop the free() in the called function.
    
    Change-Id: I2e308670c502f8e140603b4e5c16fc568088e1a8
    Signed-off-by: Antonio Borneo <[email protected]>

diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c
index 4c801b2ddb..f8218af268 100644
--- a/src/target/riscv/riscv.c
+++ b/src/target/riscv/riscv.c
@@ -4484,7 +4484,6 @@ static int parse_reg_ranges_impl(struct list_head 
*ranges, char *args,
                        }
                } else {
                        LOG_ERROR("Invalid argument '%s'.", arg);
-                       free(args);
                        return ERROR_COMMAND_SYNTAX_ERROR;
                }
 

-- 

Reply via email to