From 750c02ad0e84bceb663970d3592244b64e5dfe80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 12 Mar 2007 14:23:16 +0000 Subject: [PATCH] plugins/elements/gstmultiqueue.c: Fix small leak (free GstSingleQueue structure too, not only contents). Original commit message from CVS: * plugins/elements/gstmultiqueue.c: (gst_multi_queue_finalize), (gst_single_queue_free): Fix small leak (free GstSingleQueue structure too, not only contents). --- ChangeLog | 6 ++++++ plugins/elements/gstmultiqueue.c | 23 ++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6cd7f1cc9d..76dad09138 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-03-12 Tim-Philipp Müller + + * plugins/elements/gstmultiqueue.c: (gst_multi_queue_finalize), + (gst_single_queue_free): + Fix small leak (free GstSingleQueue structure too, not only contents). + 2007-03-10 Sebastien Moutte * gst/gstbin.c:(gst_bin_add): diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index 19b369d447..21d9d8d508 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -77,6 +77,7 @@ struct _GstMultiQueueItem }; static GstSingleQueue *gst_single_queue_new (GstMultiQueue * mqueue); +static void gst_single_queue_free (GstSingleQueue * squeue); static void wake_up_next_non_linked (GstMultiQueue * mq); static void compute_next_non_linked (GstMultiQueue * mq); @@ -260,19 +261,10 @@ static void gst_multi_queue_finalize (GObject * object) { GstMultiQueue *mqueue = GST_MULTI_QUEUE (object); - GList *tmp = mqueue->queues; - /* FILLME ? */ - /* DRAIN QUEUES */ - while (tmp) { - GstSingleQueue *sq = (GstSingleQueue *) tmp->data; - - gst_data_queue_flush (sq->queue); - g_object_unref (G_OBJECT (sq->queue)); - - tmp = g_list_next (tmp); - } + g_list_foreach (mqueue->queues, (GFunc) gst_single_queue_free, NULL); g_list_free (mqueue->queues); + mqueue->queues = NULL; /* free/unref instance data */ g_mutex_free (mqueue->qlock); @@ -1000,6 +992,15 @@ single_queue_check_full (GstDataQueue * dataq, guint visible, guint bytes, return res; } +static void +gst_single_queue_free (GstSingleQueue * sq) +{ + /* DRAIN QUEUE */ + gst_data_queue_flush (sq->queue); + g_object_unref (sq->queue); + g_free (sq); +} + static GstSingleQueue * gst_single_queue_new (GstMultiQueue * mqueue) {