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
This commit is contained in:
Michael Olbrich 2013-08-23 18:06:36 +02:00 committed by Sebastian Dröge
parent 48b8e61334
commit 3c66c2a43d

View file

@ -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;
}