[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:
parent
254b54771c
commit
f2d613799a
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue