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

From: Rafael J. Wysocki
Date: Sun Sep 25 2005 - 13:46:17 EST


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@xxxxxxx>

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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/