[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 коммит произвёл Linus Torvalds
Родитель 254b54771c
Коммит f2d613799a
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

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