Unified · Split
| @@ -50,6 +50,7 @@ static void decode_file(FILE *file_mp3, FILE *file_ref, FILE *file_out, const in · 49 unmodified lines | |||
| 50 | int i, data_bytes, samples, total_samples = 0, maxdiff = 0, mp3_size, ref_size; | 50 | int i, data_bytes, samples, total_samples = 0, maxdiff = 0, mp3_size, ref_size; |
| 51 | double MSE = 0.0, psnr; | 51 | double MSE = 0.0, psnr; |
| 52 | unsigned char *buf_mp3 = preload(file_mp3, &mp3_size), *buf_ref = preload(file_ref, &ref_size); | 52 | unsigned char *buf_mp3 = preload(file_mp3, &mp3_size), *buf_ref = preload(file_ref, &ref_size); |
| 53 | unsigned char *alloc_buf_mp3 = buf_mp3, *alloc_buf_ref = buf_ref; | ||
| 53 | 54 | ||
| 54 | mp3dec_init(&mp3d); | 55 | mp3dec_init(&mp3d); |
| 55 | #ifndef MINIMP3_NO_WAV | 56 | #ifndef MINIMP3_NO_WAV |
| @@ -101,6 +102,10 @@ static void decode_file(FILE *file_mp3, FILE *file_ref, FILE *file_out, const in · 45 unmodified lines | |||
| 101 | fwrite(wav_header(info.hz, info.channels, 16, data_bytes), 1, 44, file_out); | 102 | fwrite(wav_header(info.hz, info.channels, 16, data_bytes), 1, 44, file_out); |
| 102 | } | 103 | } |
| 103 | #endif | 104 | #endif |
| 105 | if (alloc_buf_mp3) | ||
| 106 | free(alloc_buf_mp3); | ||
| 107 | if (alloc_buf_ref) | ||
| 108 | free(alloc_buf_ref); | ||
| 104 | fclose(file_mp3); | 109 | fclose(file_mp3); |
| 105 | if (file_ref) | 110 | if (file_ref) |
| 106 | fclose(file_ref); | 111 | fclose(file_ref); |