util/PeakBuffer: fix nullptr dereference when peak_size==0
This commit is contained in:
parent
a3f9abcbd1
commit
fe7cda57e4
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue