From 0552bb1b2a8238b22ce42e652801d466900cbf7b Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Tue, 30 Oct 2012 10:12:06 -0400 Subject: [PATCH] androidcamera: Fix memleak and lose of buffer if the data queue is flushing --- sys/androidcamera/gstahcsrc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/androidcamera/gstahcsrc.c b/sys/androidcamera/gstahcsrc.c index ba67f84f3d..d6b4cbbcb0 100644 --- a/sys/androidcamera/gstahcsrc.c +++ b/sys/androidcamera/gstahcsrc.c @@ -571,7 +571,10 @@ gst_ahc_src_on_preview_frame (jbyteArray array, gpointer user_data) item->visible = TRUE; item->destroy = (GDestroyNotify) _data_queue_item_free; - gst_data_queue_push (self->queue, item); + if (!gst_data_queue_push (self->queue, item)) { + /* Can't add buffer to queue. Must be flushing. */ + _data_queue_item_free (item); + } } static void