* [PATCH] tools/mm: Free the allocated memory
@ 2024-10-22 1:25 Liu Jing
0 siblings, 0 replies; only message in thread
From: Liu Jing @ 2024-10-22 1:25 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, linux-kernel, Liu Jing
The comm_str memory needs to be freed if the search_pattern function call fails in get_comm
Signed-off-by: Liu Jing <liujing@cmss.chinamobile.com>
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.27.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-10-22 13:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-22 1:25 [PATCH] tools/mm: Free the allocated memory Liu Jing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox