decoder/DsdLib: use new[] to allocate the ID3 buffer
Don't abort the process if there's not enough memory. This buffer is not important and can be large.
This commit is contained in:
parent
56662a703c
commit
7bf638b0de
@ -128,15 +128,17 @@ dsdlib_tag_id3(InputStream &is,
|
|||||||
if (count < 10 || count > 1024 * 1024)
|
if (count < 10 || count > 1024 * 1024)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
id3_byte_t *const id3_buf = static_cast<id3_byte_t*>(xalloc(count));
|
id3_byte_t *const id3_buf = new id3_byte_t[count];
|
||||||
|
if (id3_buf == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!decoder_read_full(nullptr, is, id3_buf, count)) {
|
if (!decoder_read_full(nullptr, is, id3_buf, count)) {
|
||||||
free(id3_buf);
|
delete[] id3_buf;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct id3_tag *id3_tag = id3_tag_parse(id3_buf, count);
|
struct id3_tag *id3_tag = id3_tag_parse(id3_buf, count);
|
||||||
free(id3_buf);
|
delete[] id3_buf;
|
||||||
if (id3_tag == nullptr)
|
if (id3_tag == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user