Close file when stream_encoder init fails

This commit is contained in:
Martijn van Beurden 2022-05-28 12:19:56 +02:00
parent 9e143766ca
commit 9e425621cc
1 changed files with 5 additions and 0 deletions

View File

@ -1455,6 +1455,11 @@ FLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder)
encoder->protected_->metadata = 0; encoder->protected_->metadata = 0;
encoder->protected_->num_metadata_blocks = 0; encoder->protected_->num_metadata_blocks = 0;
} }
if(0 != encoder->private_->file) {
if(encoder->private_->file != stdout)
fclose(encoder->private_->file);
encoder->private_->file = 0;
}
return true; return true;
} }