[PATCH 2/3][Fix] swsusp: prevent possible memory leak

Rafael J. Wysocki
2005-09-25T18:45:47Z

The following patch prevents 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.

Please apply,
Rafael

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Index: linux-2.6.14-rc2-git3/kernel/power/swsusp.c
===================================================================
--- linux-2.6.14-rc2-git3.orig/kernel/power/swsusp.c 2005-09-25 18:49:00.000000000 +0200
+++ linux-2.6.14-rc2-git3/kernel/power/swsusp.c 2005-09-25 18:52:48.000000000 +0200
@@ -1437,9 +1437,9 @@
}

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;
}