Commit 105b431e authored by Max Kellermann's avatar Max Kellermann

PcmBuffer: reset size in Clear()

Fix for Mantis #3806. "PcmBuffer::Clear clears the buffer but does not reset the size. If Get is called on the same PcmBuffer later on with a size that is the same as (or less than) it was before the call to Clear, the "else" branch is taken and the memory of buffer (at the address of nullptr) is poisoned instead of the necessary allocation being performed. A memset or memcpy on the returned pointer (nullptr) causes a segmentation fault."
parent ba79f4c1
......@@ -46,6 +46,7 @@ struct PcmBuffer {
void Clear() {
g_free(buffer);
buffer = nullptr;
size = 0;
}
/**
......
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