From: Andrew Morton Fix bug identified by Daniel Marjamki: `m' is leaked on the error path. Addresses http://bugzilla.kernel.org/show_bug.cgi?id=10452 Cc: Daniel Marjamki Cc: "Antonino A. Daplas" Cc: "Randy.Dunlap" Signed-off-by: Andrew Morton --- drivers/video/uvesafb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff -puN drivers/video/uvesafb.c~drivers-video-uvesafbc-fix-error-path-memory-leak drivers/video/uvesafb.c --- a/drivers/video/uvesafb.c~drivers-video-uvesafbc-fix-error-path-memory-leak +++ a/drivers/video/uvesafb.c @@ -181,7 +181,8 @@ static int uvesafb_exec(struct uvesafb_k /* If all slots are taken -- bail out. */ if (uvfb_tasks[seq]) { mutex_unlock(&uvfb_lock); - return -EBUSY; + err = -EBUSY; + goto out; } /* Save a pointer to the kernel part of the task struct. */ @@ -205,7 +206,6 @@ static int uvesafb_exec(struct uvesafb_k err = cn_netlink_send(m, 0, gfp_any()); } } - kfree(m); if (!err && !(task->t.flags & TF_EXIT)) err = !wait_for_completion_timeout(task->done, @@ -218,7 +218,8 @@ static int uvesafb_exec(struct uvesafb_k seq++; if (seq >= UVESAFB_TASKS_MAX) seq = 0; - +out: + kfree(m); return err; } _