From: Liu Jing Date: Tue, 22 Oct 2024 01:25:26 +0000 (+0800) Subject: tools/mm: free the allocated memory X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3f1f947a322d2bdf0b16ff9158ce6be7cc23b974;p=users%2Fdwmw2%2Flinux.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 e1f2644443429..880e36df0c118 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; }