diff options
author | panciyan <panciyan@eswincomputing.com> | 2023-03-31 15:12:08 +0000 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2023-04-14 15:16:23 +0000 |
commit | 1c31f6225f41dd2bd371571e829fbf6855788d24 (patch) | |
tree | 707a951852126a0d787a1b09c94df4790ce84e36 /src/server/gdb_server.c | |
parent | 8d1dcf293a0cee71b264787c65749de3f6c4d8bc (diff) | |
download | riscv-openocd-1c31f6225f41dd2bd371571e829fbf6855788d24.zip riscv-openocd-1c31f6225f41dd2bd371571e829fbf6855788d24.tar.gz riscv-openocd-1c31f6225f41dd2bd371571e829fbf6855788d24.tar.bz2 |
src/server: Fix memory leak of reg_list
memory leak of reg_list when local_list realloc fail.
Signed-off-by: panciyan <panciyan@eswincomputing.com>
Change-Id: I6b09137ecd132ab326205f5a575a38bcc82e8469
Reviewed-on: https://review.openocd.org/c/openocd/+/7566
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src/server/gdb_server.c')
-rw-r--r-- | src/server/gdb_server.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index d8dbc2c..b15a6c1 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2348,6 +2348,7 @@ static int smp_reg_list_noread(struct target *target, local_list = realloc(local_list, combined_allocated * sizeof(struct reg *)); if (!local_list) { LOG_ERROR("realloc(%zu) failed", combined_allocated * sizeof(struct reg *)); + free(reg_list); return ERROR_FAIL; } } |