util/PeakBuffer: fix nullptr dereference when peak_size==0
This commit is contained in:
parent
a1b798e555
commit
56f082c9d4
@ -130,8 +130,9 @@ PeakBuffer::Append(const void *data, size_t length)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (peak_buffer == nullptr && peak_size > 0) {
|
if (peak_buffer == nullptr) {
|
||||||
peak_buffer = (fifo_buffer *)HugeAllocate(peak_size);
|
if (peak_size > 0)
|
||||||
|
peak_buffer = (fifo_buffer *)HugeAllocate(peak_size);
|
||||||
if (peak_buffer == nullptr)
|
if (peak_buffer == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user