diff options
author | Max Kellermann <max@duempel.org> | 2014-01-14 23:07:04 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-15 11:24:29 +0100 |
commit | 56f082c9d46eefda3057b962d15dac50d25b690d (patch) | |
tree | ad1b484942db90641a3ebacb9a5eb509fd1f291d /src | |
parent | a1b798e555a47a63470edb69d0b3786aae003776 (diff) | |
download | mpd-56f082c9d46eefda3057b962d15dac50d25b690d.tar.gz mpd-56f082c9d46eefda3057b962d15dac50d25b690d.tar.xz mpd-56f082c9d46eefda3057b962d15dac50d25b690d.zip |
util/PeakBuffer: fix nullptr dereference when peak_size==0
Diffstat (limited to 'src')
-rw-r--r-- | src/util/PeakBuffer.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/util/PeakBuffer.cxx b/src/util/PeakBuffer.cxx index a3659b8f4..d9b193dd1 100644 --- a/src/util/PeakBuffer.cxx +++ b/src/util/PeakBuffer.cxx @@ -130,8 +130,9 @@ PeakBuffer::Append(const void *data, size_t length) return true; } - if (peak_buffer == nullptr && peak_size > 0) { - peak_buffer = (fifo_buffer *)HugeAllocate(peak_size); + if (peak_buffer == nullptr) { + if (peak_size > 0) + peak_buffer = (fifo_buffer *)HugeAllocate(peak_size); if (peak_buffer == nullptr) return false; |