[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>
This commit is contained in:
Rafael J. Wysocki 2005-09-27 21:45:32 -07:00 committed by Linus Torvalds
parent 254b54771c
commit f2d613799a
1 changed files with 3 additions and 3 deletions

View File

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