sched: fix struct autogroup memory leak
PATCH 1/1 sched: fix struct autogroup memory leak
Seems I lost a change somewhere, leaking memory.
sched: fix struct autogroup memory leak
Add missing change to actually use autogroup_free().
--- kernel/sched.c | 1 + kernel/sched_autogroup.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
kernel/sched.c +1 -0
@@ -8382,6 +8382,7 @@ static void free_sched_group(struct task {free_fair_sched_group (tg);free_rt_sched_group (tg); +autogroup_free (tg);kfree (tg); }
kernel/sched_autogroup.c +2 -1
@@ -20,7 +20,8 @@ static void autogroup_init(struct task_sstatic inline void autogroup_free (struct task_group *tg) { -kfree (tg->autogroup); +if (tg->autogroup) +kfree (tg->autogroup); }static inline void autogroup_destroy (struct kref *kref)
kernel/sched_autogroup.c static void autogroup_init(struct task_s · line 25
Quoted 6 lines · Mike Galbraith
static inline void
autogroup_free(struct task_group *tg){kernel/sched_autogroup.c +2
-1-kfree (tg->autogroup); +if (tg->autogroup) +kfree (tg->autogroup); }
WARNING: kfree(NULL) is safe this check is probably not required #43: FILE: kernel/sched_autogroup.c:24:
+ if (tg->autogroup)
+ kfree(tg->autogroup);
Review
Quoted 13 lines · Peter Zijlstra
Review
Quoted 6 lines · Mike Galbraith
static inline void
autogroup_free(struct task_group *tg){(quoted diff) +2
-1- kfree(tg->autogroup); + if (tg->autogroup) + kfree(tg->autogroup); }WARNING: kfree(NULL) is safe this check is probably not required #43: FILE:
kernel/sched_autogroup.c:24:(quoted diff) +2
-0+ if (tg->autogroup) + kfree(tg->autogroup);
Once upon a time, I knew that.
sched: fix struct autogroup memory leak
Add missing change to actually use autogroup_free().
--- kernel/sched.c | 1 + 1 file changed, 1 insertion(+)
kernel/sched.c +1 -0
@@ -8382,6 +8382,7 @@ static void free_sched_group(struct task {free_fair_sched_group (tg);free_rt_sched_group (tg); +autogroup_free (tg);kfree (tg); }
[tip:sched/urgent] sched: Fix struct autogroup memory leak
In reply to Mike GalbraithCommit-ID: e9aa1dd19fe49b5aed3ca94aab87576e534d2a39 Gitweb: http://git.kernel.org/tip/e9aa1dd19fe49b5aed3ca94aab87576e534d2a39 Author: Mike Galbraith <[email protected]> AuthorDate: Wed, 5 Jan 2011 11:11:25 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 7 Jan 2011 15:54:37 +0100
sched: Fix struct autogroup memory leak
Seems I lost a change somewhere, leaking memory.
sched: fix struct autogroup memory leak
Add missing change to actually use autogroup_free().
LKML-Reference: <[email protected]>
--- kernel/sched.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
kernel/sched.c +1 -0
@@ -8377,6 +8377,7 @@ static void free_sched_group(struct task_group *tg) {free_fair_sched_group (tg);free_rt_sched_group (tg); +autogroup_free (tg);kfree (tg); }