History

test: fix uninitialized warning

lieff committed 6 years ago

Commit e660fa71 parent 73c26681 file · +3 −3Browse files

Unified · Split

minimp3_test.c+3−3
@@ -173,7 +173,7 @@ static void decode_file(const char *input_file_name, const unsigned char *buf_re · 172 unmodified lines
173173 {
174174 mp3dec_ex_t dec;
175175 size_t readed;
176− uint8_t *buf;
176+ uint8_t *buf = 0;
177177 if (MODE_STREAM == mode)
178178 {
179179 res = mp3dec_ex_open(&dec, input_file_name, MP3D_SEEK_TO_SAMPLE);
@@ -183,7 +183,7 @@ static void decode_file(const char *input_file_name, const unsigned char *buf_re · 3 unmodified lines
183183 FILE *file = fopen(input_file_name, "rb");
184184 buf = preload(file, &size);
185185 fclose(file);
186− res = mp3dec_ex_open_buf(&dec, buf, size, MP3D_SEEK_TO_SAMPLE);
186+ res = buf ? mp3dec_ex_open_buf(&dec, buf, size, MP3D_SEEK_TO_SAMPLE) : -1;
187187 } else if (MODE_STREAM_CB == mode)
188188 {
189189 FILE *file = fopen(input_file_name, "rb");
@@ -247,7 +247,7 @@ static void decode_file(const char *input_file_name, const unsigned char *buf_re · 57 unmodified lines
247247 exit(1);
248248 }
249249 mp3dec_ex_close(&dec);
250− if (MODE_STREAM_BUF == mode)
250+ if (MODE_STREAM_BUF == mode && buf)
251251 free(buf);
252252 if (MODE_STREAM_CB == mode)
253253 fclose((FILE*)io.read_data);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t