kms: fix crash if bo allocation failed when copying to dumb buffer
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 8 Sep 2017 12:57:06 +0000 (14:57 +0200)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Fri, 8 Sep 2017 13:26:21 +0000 (09:26 -0400)
commit7e38fb54224bd239a78e6f41a3801a08fd58dd2a
tree1cf9e537a9a299c98d809d0dfe6b41f51029d12e
parentfcf8b6bb908ea32073fce3b355f6cc89a67bc52c
kms: fix crash if bo allocation failed when copying to dumb buffer

If bo allocation failed we destroy the buffer and return GST_FLOW_ERROR,
but the @buffer pointer was still pointing to the address of the
destroyed buffer. gst_kms_sink_copy_to_dumb_buffer() was then trying to
unref it when bailing out causing a crash.

Leave @buffer untouched if allocation failed to fix the crash.
Also remove the check on *buffer being not NULL as gst_buffer_new()
will abort if it failed.

https://bugzilla.gnome.org/show_bug.cgi?id=787442
sys/kms/gstkmsbufferpool.c