Ensure propertly cleanup when image writting is canceled.

This commit is contained in:
Vreixo Formoso 2008-02-04 01:17:33 +01:00
parent bf5bf7af98
commit 99bcef4c53
1 changed files with 3 additions and 2 deletions

View File

@ -295,10 +295,13 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
wres = iso_write(t, buffer, BLOCK_SIZE); wres = iso_write(t, buffer, BLOCK_SIZE);
if (wres < 0) { if (wres < 0) {
/* ko, writer error, we need to go out! */ /* ko, writer error, we need to go out! */
filesrc_close(file);
return wres; return wres;
} }
} }
filesrc_close(file);
if (b < nblocks) { if (b < nblocks) {
/* premature end of file, due to error or eof */ /* premature end of file, due to error or eof */
char *name = iso_stream_get_name(file->stream); char *name = iso_stream_get_name(file->stream);
@ -329,8 +332,6 @@ int filesrc_writer_write_data(IsoImageWriter *writer)
} }
} }
} }
filesrc_close(file);
} }
return ISO_SUCCESS; return ISO_SUCCESS;