Commit fe7cda57 authored by Max Kellermann's avatar Max Kellermann

util/PeakBuffer: fix nullptr dereference when peak_size==0

parent a3f9abcb
......@@ -122,8 +122,9 @@ PeakBuffer::Append(const void *data, size_t length)
return true;
}
if (peak_buffer == nullptr && peak_size > 0) {
peak_buffer = new DynamicFifoBuffer<uint8_t>(peak_size);
if (peak_buffer == nullptr) {
if (peak_size > 0)
peak_buffer = new DynamicFifoBuffer<uint8_t>(peak_size);
if (peak_buffer == nullptr)
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment