buffer: Check return value of gst_memory_map()

Only do memory operations if the memory was succesfully map'ed

https://bugzilla.gnome.org/show_bug.cgi?id=728326
This commit is contained in:
Edward Hervey 2016-02-23 17:23:43 +01:00
parent 44423e8af3
commit f7cba27157

View file

@ -236,7 +236,12 @@ _get_merged_memory (GstBuffer * buffer, guint idx, guint length)
guint8 *ptr;
result = gst_allocator_alloc (NULL, size, NULL);
gst_memory_map (result, &dinfo, GST_MAP_WRITE);
if (result == NULL || !gst_memory_map (result, &dinfo, GST_MAP_WRITE)) {
GST_CAT_ERROR (GST_CAT_BUFFER, "Failed to map memory writable");
if (result)
gst_memory_unref (result);
return NULL;
}
ptr = dinfo.data;
left = size;