Fix potential resource leak

This commit is contained in:
Zhipeng Xue 2023-02-25 04:58:45 +08:00 committed by GitHub
parent 9382c5375b
commit a336ea5264
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -322,14 +322,17 @@ FLAC__bool DecoderSession_init_decoder(DecoderSession *decoder_session, const ch
if(fread(buffer, 1, 3, f) < 3) {
flac__utils_printf(stderr, 1, "%s: ERROR checking for ID3v2 tag\n", decoder_session->inbasefilename);
fclose(f);
return false;
}
if(memcmp(buffer, "ID3", 3) == 0){
flac__utils_printf(stderr, 1, "%s: WARNING, ID3v2 tag found. This is non-standard and strongly discouraged\n", decoder_session->inbasefilename);
if(decoder_session->treat_warnings_as_errors) {
fclose(f);
return false;
}
}
fclose(f);
}
decoder_session->decoder = FLAC__stream_decoder_new();