From: openocd-gerrit <ope...@us...> - 2025-01-31 03:22:03
|
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 ce38758e3df929d5b27947ab7b987cc319a628aa (commit) from a510d51a78f14fbb8416037a587ce1bfc6016d24 (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 ce38758e3df929d5b27947ab7b987cc319a628aa Author: Paul Fertser <fer...@gm...> Date: Tue Nov 26 23:16:15 2024 +0200 rtos: chibios: replace malloc+sprintf with alloc_printf This makes it safer and simpler at the same time. Signed-off-by: Paul Fertser <fer...@gm...> Change-Id: Ie294f1f6033ffc9f46b39210e2f7fc2f648e80ac Reviewed-on: https://review.openocd.org/c/openocd/+/8598 Tested-by: jenkins Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/src/rtos/chibios.c b/src/rtos/chibios.c index f4ee33a49..af590c2cb 100644 --- a/src/rtos/chibios.c +++ b/src/rtos/chibios.c @@ -421,9 +421,11 @@ static int chibios_update_threads(struct rtos *rtos) else state_desc = "Unknown"; - curr_thrd_details->extra_info_str = malloc(strlen( - state_desc)+8); - sprintf(curr_thrd_details->extra_info_str, "State: %s", state_desc); + curr_thrd_details->extra_info_str = alloc_printf("State: %s", state_desc); + if (!curr_thrd_details->extra_info_str) { + LOG_ERROR("Could not allocate space for thread state description"); + return -1; + } curr_thrd_details->exists = true; ----------------------------------------------------------------------- Summary of changes: src/rtos/chibios.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |