From: openocd-gerrit <ope...@us...> - 2025-03-09 03:19:06
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via b6b5edf13b5d3500c94a5afc7adda132768cd568 (commit) from 7ec11e52387390ea1fab510f10fc6cd0ed200ef5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b6b5edf13b5d3500c94a5afc7adda132768cd568 Author: Evgeniy Naydanov <evg...@sy...> Date: Fri Feb 14 19:30:55 2025 +0300 rtos/linux: handle OOM in `linux_gdb_thread_packet()` Return an error in case `calloc()` fails. Change-Id: Id1b758a1edbae3d71d625d1992579b99720d77d6 Signed-off-by: Evgeniy Naydanov <evg...@sy...> Reviewed-on: https://review.openocd.org/c/openocd/+/8762 Tested-by: jenkins Reviewed-by: zapb <de...@za...> diff --git a/src/rtos/linux.c b/src/rtos/linux.c index 5467988f3..91d9a39f2 100644 --- a/src/rtos/linux.c +++ b/src/rtos/linux.c @@ -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; ----------------------------------------------------------------------- Summary of changes: src/rtos/linux.c | 4 ++++ 1 file changed, 4 insertions(+) hooks/post-receive -- Main OpenOCD repository |