
From: Pavel Machek <pavel@ucw.cz>

This fixes memory leak when we are low on memory during suspend.  Ouch and
nr_needed_pages is only used twice, and only written :-(.  I guess that can
wait for 2.6.10.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/kernel/power/swsusp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff -puN kernel/power/swsusp.c~swsusp-bugfixes-fix-memory-leak kernel/power/swsusp.c
--- 25/kernel/power/swsusp.c~swsusp-bugfixes-fix-memory-leak	2004-12-11 22:25:04.112955832 -0800
+++ 25-akpm/kernel/power/swsusp.c	2004-12-11 22:25:04.116955224 -0800
@@ -786,12 +786,13 @@ static int swsusp_alloc(void)
 
 int suspend_prepare_image(void)
 {
-	unsigned int nr_needed_pages = 0;
+	unsigned int nr_needed_pages;
 	int error;
 
 	pr_debug("swsusp: critical section: \n");
 	if (save_highmem()) {
 		printk(KERN_CRIT "Suspend machine: Not enough free pages for highmem\n");
+		restore_highmem();
 		return -ENOMEM;
 	}
 
_
