mirror of
https://github.com/linux-msm/openocd.git
synced 2026-02-25 13:15:07 -08:00
rtos/rtos: handle OOM in rtos_thread_packet()
Return an error in case `calloc()` fails. Change-Id: Ibb21a62991be83be8b219887953ccf27156f8af5 Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8763 Tested-by: jenkins Reviewed-by: zapb <dev@zapb.de>
This commit is contained in:
committed by
Tomas Vanek
parent
953ad9e116
commit
7ec11e5238
@@ -362,6 +362,10 @@ int rtos_thread_packet(struct connection *connection, char const *packet, int pa
|
||||
str_size += strlen(detail->extra_info_str);
|
||||
|
||||
char *tmp_str = calloc(str_size + 9, sizeof(char));
|
||||
if (!tmp_str) {
|
||||
LOG_ERROR("Out of memory");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
char *tmp_str_ptr = tmp_str;
|
||||
|
||||
if (detail->thread_name_str)
|
||||
|
||||
Reference in New Issue
Block a user