From: Liu Jing Date: Tue, 22 Oct 2024 01:25:26 +0000 (+0800) Subject: tools/mm: free the allocated memory X-Git-Tag: v6.13-rc1~99^2~109 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=3f1f947a322d2bdf0b16ff9158ce6be7cc23b974;p=linux-2.6-block.git tools/mm: free the allocated memory The comm_str memory needs to be freed if the search_pattern function call fails in get_comm [akpm@linux-foundation.org: fix whitespace] Link: https://lkml.kernel.org/r/20241022012526.7597-1-liujing@cmss.chinamobile.com Signed-off-by: Liu Jing Signed-off-by: Andrew Morton --- diff --git a/tools/mm/page_owner_sort.c b/tools/mm/page_owner_sort.c index e1f264444342..880e36df0c11 100644 --- a/tools/mm/page_owner_sort.c +++ b/tools/mm/page_owner_sort.c @@ -377,6 +377,7 @@ static char *get_comm(char *buf) if (errno != 0) { if (debug_on) fprintf(stderr, "wrong comm in follow buf:\n%s\n", buf); + free(comm_str); return NULL; }