From 54de894e523a4d18cde07ac4d204de73b1ddf68a Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 6 Jan 2023 01:28:30 +0800 Subject: [PATCH] mm/heap: Skip memset backtrace buffer Signed-off-by: Xiang Xiao --- mm/mm_heap/mm.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/mm_heap/mm.h b/mm/mm_heap/mm.h index e59c44ffb1..4a980eccd8 100644 --- a/mm/mm_heap/mm.h +++ b/mm/mm_heap/mm.h @@ -88,8 +88,11 @@ tcb = nxsched_get_tcb(tmp->pid); \ if ((heap)->mm_procfs.backtrace || (tcb && tcb->flags & TCB_FLAG_HEAP_DUMP)) \ { \ - memset(tmp->backtrace, 0, sizeof(tmp->backtrace)); \ - backtrace(tmp->backtrace, CONFIG_MM_BACKTRACE); \ + int n = backtrace(tmp->backtrace, CONFIG_MM_BACKTRACE); \ + if (n < CONFIG_MM_BACKTRACE) \ + { \ + tmp->backtrace[n] = 0; \ + } \ } \ else \ { \