Skip to content

Commit

Permalink
tools/mm: free the allocated memory
Browse files Browse the repository at this point in the history
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 <liujing@cmss.chinamobile.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Liu Jing authored and Andrew Morton committed Nov 7, 2024
1 parent 39ac998 commit 3f1f947
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tools/mm/page_owner_sort.c
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 3f1f947

Please sign in to comment.