Commit 1b5ddc1e authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

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.
parent 762dda38
...@@ -196,9 +196,9 @@ static GstMemory *wg_allocator_alloc(GstAllocator *gst_allocator, gsize size, ...@@ -196,9 +196,9 @@ static GstMemory *wg_allocator_alloc(GstAllocator *gst_allocator, gsize size,
pthread_mutex_lock(&allocator->mutex); pthread_mutex_lock(&allocator->mutex);
memory->sample = allocator->next_sample; memory->sample = allocator->next_sample;
if (memory->sample && memory->sample->max_size >= size) allocator->next_sample = NULL;
allocator->next_sample = NULL;
else if (memory->sample && memory->sample->max_size < size)
release_memory_sample(allocator, memory, true); release_memory_sample(allocator, memory, true);
list_add_tail(&allocator->memory_list, &memory->entry); list_add_tail(&allocator->memory_list, &memory->entry);
......
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