From: Richard Braun Date: Wed, 11 Mar 2015 13:04:15 +0000 (+0100) Subject: ChibiOS: fix crash on auto detection X-Git-Tag: v0.9.0-rc1~31 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7090edc813525caaade84a6322fdce89d3cd8f6a;p=openocd ChibiOS: fix crash on auto detection The detection framework assumes rtos->symbols is dynamically allocated, an assumption that the ChibiOS variant breaks by providing a raw statically allocated symbol list. Change-Id: I379bcc2af99006912608ddd3f646ff7085606f47 Signed-off-by: Richard Braun Reviewed-on: http://openocd.zylin.com/2597 Tested-by: jenkins Reviewed-by: Stian Skjelstad Reviewed-by: Tomas Vanek Reviewed-by: Paul Fertser --- diff --git a/src/rtos/ChibiOS.c b/src/rtos/ChibiOS.c index b94e286f..84393860 100644 --- a/src/rtos/ChibiOS.c +++ b/src/rtos/ChibiOS.c @@ -507,7 +507,12 @@ static int ChibiOS_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, cha static int ChibiOS_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]) { - *symbol_list = ChibiOS_symbol_list; + *symbol_list = malloc(sizeof(ChibiOS_symbol_list)); + + if (*symbol_list == NULL) + return ERROR_FAIL; + + memcpy(*symbol_list, ChibiOS_symbol_list, sizeof(ChibiOS_symbol_list)); return 0; }