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>
This commit is contained in:
parent
8d1dcf293a
commit
1c31f6225f
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue