Commit e8a46787 authored by Matt Fischer's avatar Matt Fischer Committed by Nicolas Dufresne

v4l2allocator: Fix memory leak with dmabuf

This patch fixes a memory leak that is caused if the dmabuf file
descriptor dup fails.  Previously, _cleanup_failed_alloc() would
not unref the memory because mems_allocated had not yet been
incremented.

https://bugzilla.gnome.org/show_bug.cgi?id=784302
parent 83987b50
......@@ -888,6 +888,8 @@ gst_v4l2_allocator_alloc_dmabuf (GstV4l2Allocator * allocator,
gst_object_ref (allocator);
}
group->mems_allocated++;
g_assert (gst_is_v4l2_memory (group->mem[i]));
mem = (GstV4l2Memory *) group->mem[i];
......@@ -901,7 +903,6 @@ gst_v4l2_allocator_alloc_dmabuf (GstV4l2Allocator * allocator,
GST_V4L2_MEMORY_QUARK, mem, (GDestroyNotify) gst_memory_unref);
group->mem[i] = dma_mem;
group->mems_allocated++;
}
gst_v4l2_allocator_reset_size (allocator, group);
......
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