From 3c66c2a43d6f189b07ab682b4d23db04ade9acbc Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Fri, 23 Aug 2013 18:06:36 +0200 Subject: [PATCH] dmabuf: fix mmap counting A successful gst_dmabuf_mem_map must always increment the mmap count. Otherwise the first gst_dmabuf_mem_unmap will unmap the memory and all other user will access unmapped memory. https://bugzilla.gnome.org/show_bug.cgi?id=706680 --- gst-libs/gst/allocators/gstdmabuf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/allocators/gstdmabuf.c b/gst-libs/gst/allocators/gstdmabuf.c index 1c8abc4..87d0c75 100644 --- a/gst-libs/gst/allocators/gstdmabuf.c +++ b/gst-libs/gst/allocators/gstdmabuf.c @@ -90,8 +90,10 @@ gst_dmabuf_mem_map (GstMemory * gmem, gsize maxsize, GstMapFlags flags) if (mem->data) { /* only return address if mapping flags are a subset * of the previous flags */ - if ((mem->mmapping_flags & prot) && (mem->mmap_size >= maxsize)) + if ((mem->mmapping_flags & prot) && (mem->mmap_size >= maxsize)) { ret = mem->data; + mem->mmap_count++; + } goto out; } -- 2.7.4