aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-01-29 08:21:51 +0100
committerMax Kellermann <max@duempel.org>2015-01-29 08:24:34 +0100
commit7bf638b0deedf02aea46e72f6f3c848e86f2ce0d (patch)
tree6ddc508d785ff6af0486490165bbc81529c54aeb /src/decoder
parent56662a703c82252d9d5ff7002d74ea28527aaa1d (diff)
downloadmpd-7bf638b0deedf02aea46e72f6f3c848e86f2ce0d.tar.gz
mpd-7bf638b0deedf02aea46e72f6f3c848e86f2ce0d.tar.xz
mpd-7bf638b0deedf02aea46e72f6f3c848e86f2ce0d.zip
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.
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/plugins/DsdLib.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/decoder/plugins/DsdLib.cxx b/src/decoder/plugins/DsdLib.cxx
index 180981620..d826970f7 100644
--- a/src/decoder/plugins/DsdLib.cxx
+++ b/src/decoder/plugins/DsdLib.cxx
@@ -128,15 +128,17 @@ dsdlib_tag_id3(InputStream &is,
if (count < 10 || count > 1024 * 1024)
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)) {
- free(id3_buf);
+ delete[] id3_buf;
return;
}
struct id3_tag *id3_tag = id3_tag_parse(id3_buf, count);
- free(id3_buf);
+ delete[] id3_buf;
if (id3_tag == nullptr)
return;