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.
From: Rémi Bernon rbernon@codeweavers.com
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);
This merge request was approved by Zebediah Figura.