summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Isorce <jisorce@oblong.com>2017-06-29 23:17:26 +0100
committerTim-Philipp Müller <tim@centricular.com>2018-03-28 13:35:33 +0100
commitf9467ff1065e95bd4129b1cf6ab410e357514472 (patch)
treebd06cbdb14f4f4bc58d8ce63c7b71c03820fe5e2
parent46d66ccbdb1e83c74ed59592f14add148bb5f9bb (diff)
omxvideodec: fix buffer leak when eglimage setup fails
Can happen if gst_buffer_pool_acquire_buffer succeeds but gst_buffer_n_memory (buffer) is not exactly 1. In theory this should not happen because the decoder requests EGLImage(RGBA) but better to fix any leak on corner cases. https://bugzilla.gnome.org/show_bug.cgi?id=784365
-rw-r--r--omx/gstomxvideodec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
index d12ee8f..c934a4d 100644
--- a/omx/gstomxvideodec.c
+++ b/omx/gstomxvideodec.c
@@ -639,7 +639,7 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self)
GST_DEBUG_OBJECT (self, "Trying to allocate %d EGLImages", min);
for (i = 0; i < min; i++) {
- GstBuffer *buffer;
+ GstBuffer *buffer = NULL;
GstMemory *mem;
GstGLMemoryEGL *gl_mem;
@@ -648,6 +648,7 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self)
|| !(mem = gst_buffer_peek_memory (buffer, 0))
|| !GST_IS_GL_MEMORY_EGL_ALLOCATOR (mem->allocator)) {
GST_INFO_OBJECT (self, "Failed to allocated %d-th EGLImage", i);
+ gst_buffer_replace (&buffer, NULL);
g_list_free_full (buffers, (GDestroyNotify) gst_buffer_unref);
g_list_free (images);
buffers = NULL;