From: Rafael J. Wysocki Date: Wed, 28 Sep 2005 04:45:32 +0000 (-0700) Subject: [PATCH] swsusp: prevent possible memory leak X-Git-Tag: v2.6.14-rc3~90 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=f2d613799af915da1fd78463ba8ec5086a0d6f92;p=linux-2.6-omap-h63xx.git [PATCH] swsusp: prevent possible memory leak Prevent swsusp from leaking some memory in case of an error in read_pagedir(). It also prevents the BUG_ON() from triggering if there's an error while reading swap. Signed-off-by: Rafael J. Wysocki Acked-by: Pavel Machek Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index 8aef1b49150..0dfb2494890 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c @@ -1437,9 +1437,9 @@ static int read_pagedir(struct pbe *pblist) } if (error) - free_page((unsigned long)pblist); - - BUG_ON(i != swsusp_info.pagedir_pages); + free_pagedir(pblist); + else + BUG_ON(i != swsusp_info.pagedir_pages); return error; }