rtos/linux: handle OOM in linux_gdb_thread_packet()
Return an error in case `calloc()` fails. Change-Id: Id1b758a1edbae3d71d625d1992579b99720d77d6 Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8762 Tested-by: jenkins Reviewed-by: zapb <dev@zapb.de>
This commit is contained in:
committed by
Tomas Vanek
parent
7ec11e5238
commit
b6b5edf13b
@@ -1040,6 +1040,10 @@ static int linux_gdb_thread_packet(struct target *target,
|
||||
return ERROR_TARGET_FAILURE;
|
||||
|
||||
char *out_str = calloc(MAX_THREADS * 17 + 10, 1);
|
||||
if (!out_str) {
|
||||
LOG_ERROR("Out of memory");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
char *tmp_str = out_str;
|
||||
tmp_str += sprintf(tmp_str, "m");
|
||||
struct threads *temp = linux_os->thread_list;
|
||||
|
||||
Reference in New Issue
Block a user