shithub: mp3dec

Download patch

ref: e660fa72f94d530d503045db51790bb91e454a6d
parent: 73c26681825e79d9349e81c00b13aeb79f7d3b3f
author: lieff <lieff@users.noreply.github.com>
date: Thu Feb 13 20:25:56 EST 2020

test: fix uninitialized warning

--- a/minimp3_test.c
+++ b/minimp3_test.c
@@ -173,7 +173,7 @@
     {
         mp3dec_ex_t dec;
         size_t readed;
-        uint8_t *buf;
+        uint8_t *buf = 0;
         if (MODE_STREAM == mode)
         {
             res = mp3dec_ex_open(&dec, input_file_name, MP3D_SEEK_TO_SAMPLE);
@@ -183,7 +183,7 @@
             FILE *file = fopen(input_file_name, "rb");
             buf = preload(file, &size);
             fclose(file);
-            res = mp3dec_ex_open_buf(&dec, buf, size, MP3D_SEEK_TO_SAMPLE);
+            res = buf ? mp3dec_ex_open_buf(&dec, buf, size, MP3D_SEEK_TO_SAMPLE) : -1;
         } else if (MODE_STREAM_CB == mode)
         {
             FILE *file = fopen(input_file_name, "rb");
@@ -247,7 +247,7 @@
             exit(1);
         }
         mp3dec_ex_close(&dec);
-        if (MODE_STREAM_BUF == mode)
+        if (MODE_STREAM_BUF == mode && buf)
             free(buf);
         if (MODE_STREAM_CB == mode)
             fclose((FILE*)io.read_data);