diff mbox series

tools/mm: Free the allocated memory

Message ID 20241022012526.7597-1-liujing@cmss.chinamobile.com (mailing list archive)
State New
Headers show
Series tools/mm: Free the allocated memory | expand

Commit Message

liujing Oct. 22, 2024, 1:25 a.m. UTC
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 mbox series

Patch

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;
 	}