mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
Merge pull request #2516 from npwoods/imgtool_fix_filelock_on_error
Imgtool: Proper cleanup of floppy object after create/open failure
This commit is contained in:
commit
a9083f3af8
@ -140,6 +140,11 @@ static imgtoolerr_t imgtool_floppy_open_internal(imgtool::image &image, imgtool:
|
||||
done:
|
||||
if (f)
|
||||
delete f;
|
||||
if (err && fimg->floppy)
|
||||
{
|
||||
floppy_close(fimg->floppy);
|
||||
fimg->floppy = nullptr;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -200,6 +205,11 @@ static imgtoolerr_t imgtool_floppy_create(imgtool::image &image, imgtool::stream
|
||||
done:
|
||||
if (f)
|
||||
delete f;
|
||||
if (err && fimg->floppy)
|
||||
{
|
||||
floppy_close(fimg->floppy);
|
||||
fimg->floppy = nullptr;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user