Module: wine Branch: master Commit: 1b5ddc1e2f9e4dc4bbda2318e8e13adc6067ba52 URL: https://gitlab.winehq.org/wine/wine/-/commit/1b5ddc1e2f9e4dc4bbda2318e8e13ad...
Author: Rémi Bernon rbernon@codeweavers.com Date: Sun Jun 25 11:17:12 2023 +0200
winegstreamer: Avoid releasing wg_allocator memory samples twice.
When the sample size is too small, we were releasing it from the memory, but kept the next_sample pointer set. Later, when the transform removes the sample from the allocator, its refcount was decremented one more time, effectively leaking the sample.
---
dlls/winegstreamer/wg_allocator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/winegstreamer/wg_allocator.c b/dlls/winegstreamer/wg_allocator.c index 5cc2a6fcf12..a46a3de142a 100644 --- a/dlls/winegstreamer/wg_allocator.c +++ b/dlls/winegstreamer/wg_allocator.c @@ -196,9 +196,9 @@ static GstMemory *wg_allocator_alloc(GstAllocator *gst_allocator, gsize size, pthread_mutex_lock(&allocator->mutex);
memory->sample = allocator->next_sample; - if (memory->sample && memory->sample->max_size >= size) - allocator->next_sample = NULL; - else + allocator->next_sample = NULL; + + if (memory->sample && memory->sample->max_size < size) release_memory_sample(allocator, memory, true);
list_add_tail(&allocator->memory_list, &memory->entry);