This is an automated email from Gerrit.

"Paul Fertser <fercer...@gmail.com>" just uploaded a new patch set to Gerrit, 
which you can find at https://review.openocd.org/c/openocd/+/8598

-- gerrit

commit 25f999388af89e6e231af7b5f700f15725a47c6b
Author: Paul Fertser <fercer...@gmail.com>
Date:   Tue Nov 26 23:16:15 2024 +0200

    rtos: chibios: replace malloc+sprintf with asprintf
    
    This makes it safer and simpler at the same time.
    
    Signed-off-by: Paul Fertser <fercer...@gmail.com>
    Change-Id: Ie294f1f6033ffc9f46b39210e2f7fc2f648e80ac

diff --git a/src/rtos/chibios.c b/src/rtos/chibios.c
index f4ee33a490..c7be0afdd6 100644
--- a/src/rtos/chibios.c
+++ b/src/rtos/chibios.c
@@ -421,9 +421,7 @@ 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);
+               asprintf(&curr_thrd_details->extra_info_str, "State: %s", 
state_desc);
 
                curr_thrd_details->exists = true;
 

-- 

Reply via email to