From bb07413ec23152539544e6fac879909bab17c76a Mon Sep 17 00:00:00 2001 From: Liu Jing Date: Tue, 22 Oct 2024 09:25:26 +0800 Subject: [PATCH] tools/mm: free the allocated memory The comm_str memory needs to be freed if the search_pattern function call fails in get_comm Link: https://lkml.kernel.org/r/20241022012526.7597-1-liujing@cmss.chinamobile.com Signed-off-by: Liu Jing Signed-off-by: Andrew Morton --- tools/mm/page_owner_sort.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/mm/page_owner_sort.c b/tools/mm/page_owner_sort.c index e1f264444342..724d024e0756 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; } -- 2.49.0