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 <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/9164 Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com> Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
committed by
Tomas Vanek
parent
be083909b7
commit
8c41070415
@@ -4473,7 +4473,6 @@ static int parse_reg_ranges_impl(struct list_head *ranges, char *args,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("Invalid argument '%s'.", arg);
|
LOG_ERROR("Invalid argument '%s'.", arg);
|
||||||
free(args);
|
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user