mm/page_owner: Fix memory leak
PATCH 1/1 mm/page_owner: Fix memory leak
Call kfree on list2 after using it.
--- tools/vm/page_owner_sort.c | 2 ++ 1 file changed, 2 insertions(+)
tools/vm/page_owner_sort.c +2 -0
@@ -139,6 +139,8 @@ int main(int argc, char **argv)for (i =0 ; i < count; i++)fprintf (fout,"%d times:\n%s\n" , list2[i].num, list2[i].txt); + +kfree (list2);return 0 ; }
Signature · 1 line
2.1.0
Quoted 12 lines · Valentin Ilie
Call kfree on list2 after using it.
Signed-off-by Valentin Ilie <[email protected]>--- tools/vm/page_owner_sort.c | 2 ++ 1 file changed, 2 insertions(+)tools/vm/page_owner_sort.c +0
-0
tools/vm/page_owner_sort.c int main(int argc, char **argv) · line 142
Quoted 4 lines
tools/vm/page_owner_sort.c +1
-0@@ -139,6 +139,8 @@ int main(int argc, char **argv)for (i =0 ; i < count; i++)fprintf (fout,"%d times:\n%s\n" , list2[i].num, list2[i].txt); +
Checkpatch would have caught the tab you added here.
tools/vm/page_owner_sort.c int main(int argc, char **argv) · line 143
Quoted 1 line
tools/vm/page_owner_sort.c +1
-0+kfree (list2);
You didn't even compile this, did you?
tools/vm/page_owner_sort.c int main(int argc, char **argv) · line 146
Quoted 2 lines
tools/vm/page_owner_sort.c +0
-0return 0 ; }
Thanks,
Paul Bolle
(I dislike it when people set a trap for me, so on second thought I tell you what I should have added right away.)
Quoted 20 lines · Paul Bolle
Quoted 12 lines · Valentin Ilie
Call kfree on list2 after using it.
Signed-off-by Valentin Ilie <[email protected]>--- tools/vm/page_owner_sort.c | 2 ++ 1 file changed, 2 insertions(+)tools/vm/page_owner_sort.c +0
-0tools/vm/page_owner_sort.c int main(int argc, char **argv) · line 142
Quoted 4 lines
tools/vm/page_owner_sort.c +1
-0@@ -139,6 +139,8 @@ int main(int argc, char **argv)for (i =0 ; i < count; i++)fprintf (fout,"%d times:\n%s\n" , list2[i].num, list2[i].txt); +Checkpatch would have caught the tab you added here.
Quoted 6 lines
tools/vm/page_owner_sort.c int main(int argc, char **argv) · line 143
Quoted 1 line
tools/vm/page_owner_sort.c +1
-0+kfree (list2);You didn't even compile this, did you?
Quoted 2 lines
tools/vm/page_owner_sort.c +0
-0return 0 ; }
Before you resend: what happens to the resources of a userspace program when its main() returns?
Paul Bolle
Quoted 2 lines · Paul Bolle
Before you resend: what happens to the resources of a userspace program when its
main()returns?
On top of that, I should have used free, not kfree. I will resend v2 ..
Sorry for the mess
Signature · 1 line
Valentin