[PATCH] Fix memory leak in arch/powerpc/sysdev/qe_lib/uuc_fast.c ucc_fast_init()

Tony Breeds tony at bakeyournoodle.com
Mon Aug 18 14:00:14 EST 2008


In kernel bugzilla 11364 Daniel Marjamäki notes that if the an the ioremap
fails we'll return -ENOMEM without kfree()ing uccf.

Add a kfree on the error path.

Signed-off-by: Tony Breeds <tony at bakeyournoodle.com>
---
 arch/powerpc/sysdev/qe_lib/ucc_fast.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/qe_lib/ucc_fast.c b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
index 1aecb07..3455abc 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_fast.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
@@ -208,6 +208,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc
 	uccf->uf_regs = ioremap(uf_info->regs, sizeof(struct ucc_fast));
 	if (uccf->uf_regs == NULL) {
 		printk(KERN_ERR "%s: Cannot map UCC registers\n", __func__);
+		kfree(uccf);
 		return -ENOMEM;
 	}
 
-- 
1.5.6.3




More information about the Linuxppc-dev mailing list