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).
This commit is contained in:
Tim-Philipp Müller 2007-03-12 14:23:16 +00:00
parent 25b5fc7a7a
commit 750c02ad0e
2 changed files with 18 additions and 11 deletions

View file

@ -1,3 +1,9 @@
2007-03-12 Tim-Philipp Müller <tim at centricular dot net>
* 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 <sebastien@moutte.net> 2007-03-10 Sebastien Moutte <sebastien@moutte.net>
* gst/gstbin.c:(gst_bin_add): * gst/gstbin.c:(gst_bin_add):

View file

@ -77,6 +77,7 @@ struct _GstMultiQueueItem
}; };
static GstSingleQueue *gst_single_queue_new (GstMultiQueue * mqueue); 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 wake_up_next_non_linked (GstMultiQueue * mq);
static void compute_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) gst_multi_queue_finalize (GObject * object)
{ {
GstMultiQueue *mqueue = GST_MULTI_QUEUE (object); GstMultiQueue *mqueue = GST_MULTI_QUEUE (object);
GList *tmp = mqueue->queues;
/* FILLME ? */ g_list_foreach (mqueue->queues, (GFunc) gst_single_queue_free, NULL);
/* 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_free (mqueue->queues); g_list_free (mqueue->queues);
mqueue->queues = NULL;
/* free/unref instance data */ /* free/unref instance data */
g_mutex_free (mqueue->qlock); g_mutex_free (mqueue->qlock);
@ -1000,6 +992,15 @@ single_queue_check_full (GstDataQueue * dataq, guint visible, guint bytes,
return res; 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 * static GstSingleQueue *
gst_single_queue_new (GstMultiQueue * mqueue) gst_single_queue_new (GstMultiQueue * mqueue)
{ {