Unified · Split
| @@ -173,7 +173,7 @@ static void decode_file(const char *input_file_name, const unsigned char *buf_re · 172 unmodified lines | ||
| 173 | 173 | { |
| 174 | 174 | mp3dec_ex_t dec; |
| 175 | 175 | size_t readed; |
| 176 | − uint8_t *buf; | |
| 176 | + uint8_t *buf = 0; | |
| 177 | 177 | if (MODE_STREAM == mode) |
| 178 | 178 | { |
| 179 | 179 | 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 | ||
| 183 | 183 | FILE *file = fopen(input_file_name, "rb"); |
| 184 | 184 | buf = preload(file, &size); |
| 185 | 185 | 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; | |
| 187 | 187 | } else if (MODE_STREAM_CB == mode) |
| 188 | 188 | { |
| 189 | 189 | 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 | ||
| 247 | 247 | exit(1); |
| 248 | 248 | } |
| 249 | 249 | mp3dec_ex_close(&dec); |
| 250 | − if (MODE_STREAM_BUF == mode) | |
| 250 | + if (MODE_STREAM_BUF == mode && buf) | |
| 251 | 251 | free(buf); |
| 252 | 252 | if (MODE_STREAM_CB == mode) |
| 253 | 253 | fclose((FILE*)io.read_data); |