mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
dmabuf: handle mmap failure
Otherwise gstreamer may segfault trying to access MAP_FAILED. https://bugzilla.gnome.org/show_bug.cgi?id=699470
This commit is contained in:
parent
f9befdecfe
commit
347898d516
1 changed files with 8 additions and 1 deletions
|
@ -96,8 +96,15 @@ gst_dmabuf_mem_map (GstMemory * gmem, gsize maxsize, GstMapFlags flags)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mem->fd != -1)
|
if (mem->fd != -1) {
|
||||||
mem->data = mmap (0, maxsize, prot, MAP_SHARED, mem->fd, 0);
|
mem->data = mmap (0, maxsize, prot, MAP_SHARED, mem->fd, 0);
|
||||||
|
if (mem->data == MAP_FAILED) {
|
||||||
|
mem->data = NULL;
|
||||||
|
GST_ERROR ("%p: fd %d: mmap failed: %s", mem, mem->fd,
|
||||||
|
g_strerror(errno));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GST_DEBUG ("%p: fd %d: mapped %p", mem, mem->fd, mem->data);
|
GST_DEBUG ("%p: fd %d: mapped %p", mem, mem->fd, mem->data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue