shithub: mp3dec

Download patch

ref: 95bd7fc0fec652d5542626a91d4fbb85f70baa29
parent: 703272ce0ae2820e3a666f70050e12ffed6dbf55
author: lieff <lieff@users.noreply.github.com>
date: Wed Jan 31 07:51:12 EST 2018

fix asan leak warnings

--- a/minimp3_test.c
+++ b/minimp3_test.c
@@ -50,6 +50,7 @@
     int i, data_bytes, samples, total_samples = 0, maxdiff = 0, mp3_size, ref_size;
     double MSE = 0.0, psnr;
     unsigned char *buf_mp3 = preload(file_mp3, &mp3_size), *buf_ref = preload(file_ref, &ref_size);
+    unsigned char *alloc_buf_mp3 = buf_mp3, *alloc_buf_ref = buf_ref;
 
     mp3dec_init(&mp3d);
 #ifndef MINIMP3_NO_WAV
@@ -101,6 +102,10 @@
         fwrite(wav_header(info.hz, info.channels, 16, data_bytes), 1, 44, file_out);
     }
 #endif
+    if (alloc_buf_mp3)
+        free(alloc_buf_mp3);
+    if (alloc_buf_ref)
+        free(alloc_buf_ref);
     fclose(file_mp3);
     if (file_ref)
         fclose(file_ref);