restore_backup() throws core dump

restore_backup() throws core dump during releasing fdlist.
Loop for closing handlers checks next_spare variable,
but iterates disk_count.

Reported-by: Adam Kwolek <adam.kwolek@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2011-10-05 13:29:16 +11:00
parent 7aa437c2d8
commit cc7f63e553
1 changed files with 3 additions and 3 deletions

6
Grow.c
View File

@ -78,9 +78,9 @@ int restore_backup(struct supertype *st,
backup_file, verbose > 0);
while (next_spare > 0) {
disk_count--;
if (fdlist[disk_count] >= 0)
close(fdlist[disk_count]);
next_spare--;
if (fdlist[next_spare] >= 0)
close(fdlist[next_spare]);
}
free(fdlist);
if (err) {