summaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2005-09-28 06:45:32 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-28 16:46:40 +0200
commitf2d613799af915da1fd78463ba8ec5086a0d6f92 (patch)
treedba02c1108bd9e101ce4986c458a2fa2a400eb56 /kernel/power
parent[PATCH] swsusp: remove wrong code from data_free (diff)
downloadlinux-f2d613799af915da1fd78463ba8ec5086a0d6f92.tar.xz
linux-f2d613799af915da1fd78463ba8ec5086a0d6f92.zip
[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 <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/swsusp.c6
1 files changed, 3 insertions, 3 deletions
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;
}