From: Rafael J. Wysocki Date: Wed, 28 Sep 2005 04:45:32 +0000 (-0700) Subject: [PATCH] swsusp: prevent possible memory leak X-Git-Tag: firefly_0821_release~40980 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f2d613799af915da1fd78463ba8ec5086a0d6f92;p=firefly-linux-kernel-4.4.55.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 8aef1b49150f..0dfb24948907 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; }