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 | 50 | int i, data_bytes, samples, total_samples = 0, maxdiff = 0, mp3_size, ref_size; |
| 51 | 51 | double MSE = 0.0, psnr; |
| 52 | 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 | 55 | mp3dec_init(&mp3d); |
| 55 | 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 | 102 | fwrite(wav_header(info.hz, info.channels, 16, data_bytes), 1, 44, file_out); |
| 102 | 103 | } |
| 103 | 104 | #endif |
| 105 | + if (alloc_buf_mp3) | |
| 106 | + free(alloc_buf_mp3); | |
| 107 | + if (alloc_buf_ref) | |
| 108 | + free(alloc_buf_ref); | |
| 104 | 109 | fclose(file_mp3); |
| 105 | 110 | if (file_ref) |
| 106 | 111 | fclose(file_ref); |