Commit 36e55fc8 authored by Julien Moutte Moutte's avatar Julien Moutte Moutte
Browse files

ext/annodex/: Fix possible memleaks.

Original commit message from CVS:
2006-02-25  Julien MOUTTE  <julien@moutte.net>

* ext/annodex/gstcmmldec.c: (gst_cmml_dec_class_init),
(gst_cmml_dec_finalize), (gst_cmml_dec_change_state):
* ext/annodex/gstcmmlenc.c: (gst_cmml_enc_class_init),
(gst_cmml_enc_finalize), (gst_cmml_enc_change_state):
* ext/annodex/gstcmmlutils.c: (gst_cmml_track_list_destroy): Fix
possible memleaks.
parent 22e1a6cf
2006-02-25 Julien MOUTTE <julien@moutte.net>
* ext/annodex/gstcmmldec.c: (gst_cmml_dec_class_init),
(gst_cmml_dec_finalize), (gst_cmml_dec_change_state):
* ext/annodex/gstcmmlenc.c: (gst_cmml_enc_class_init),
(gst_cmml_enc_finalize), (gst_cmml_enc_change_state):
* ext/annodex/gstcmmlutils.c: (gst_cmml_track_list_destroy): Fix
possible memleaks.
2006-02-25 Julien MOUTTE <julien@moutte.net>
* tests/check/Makefile.am:
......
......@@ -121,6 +121,8 @@ static void gst_cmml_dec_push_clip (GstCmmlDec * dec, GstCmmlTagClip * clip);
static void gst_cmml_dec_send_clip_tag (GstCmmlDec * dec,
GstCmmlTagClip * clip);
static void gst_cmml_dec_finalize (GObject * object);
static void
gst_cmml_dec_base_init (gpointer g_class)
{
......@@ -142,6 +144,7 @@ gst_cmml_dec_class_init (GstCmmlDecClass * dec_class)
klass->set_property = gst_cmml_dec_set_property;
klass->get_property = gst_cmml_dec_get_property;
klass->finalize = gst_cmml_dec_finalize;
g_object_class_install_property (klass, GST_CMML_DEC_WAIT_CLIP_END,
g_param_spec_boolean ("wait-clip-end-time",
......@@ -199,6 +202,19 @@ gst_cmml_dec_set_property (GObject * object, guint property_id,
}
}
static void
gst_cmml_dec_finalize (GObject * object)
{
GstCmmlDec *dec = GST_CMML_DEC (object);
if (dec->tracks) {
gst_cmml_track_list_destroy (dec->tracks);
dec->tracks = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static GstStateChangeReturn
gst_cmml_dec_change_state (GstElement * element, GstStateChange transition)
{
......@@ -235,6 +251,7 @@ gst_cmml_dec_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_cmml_parser_free (dec->parser);
gst_cmml_track_list_destroy (dec->tracks);
dec->tracks = NULL;
break;
default:
break;
......
......@@ -110,6 +110,8 @@ static GstFlowReturn gst_cmml_enc_push_clip (GstCmmlEnc * enc,
GstCmmlTagClip * clip, GstClockTime prev_clip_time);
static GstFlowReturn gst_cmml_enc_push (GstCmmlEnc * enc, GstBuffer * buffer);
static void gst_cmml_enc_finalize (GObject * object);
static void
gst_cmml_enc_base_init (gpointer g_class)
{
......@@ -129,6 +131,7 @@ gst_cmml_enc_class_init (GstCmmlEncClass * enc_class)
klass->get_property = gst_cmml_enc_get_property;
klass->set_property = gst_cmml_enc_set_property;
klass->finalize = gst_cmml_enc_finalize;
g_object_class_install_property (klass, GST_CMML_ENC_GRANULERATE_N,
g_param_spec_int64 ("granule-rate-numerator",
......@@ -211,6 +214,19 @@ gst_cmml_enc_get_property (GObject * object, guint property_id,
}
}
static void
gst_cmml_enc_finalize (GObject * object)
{
GstCmmlEnc *enc = GST_CMML_ENC (object);
if (enc->tracks) {
gst_cmml_track_list_destroy (enc->tracks);
enc->tracks = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static GstStateChangeReturn
gst_cmml_enc_change_state (GstElement * element, GstStateChange transition)
{
......@@ -244,6 +260,7 @@ gst_cmml_enc_change_state (GstElement * element, GstStateChange transition)
case GST_STATE_CHANGE_PAUSED_TO_READY:
{
gst_cmml_track_list_destroy (enc->tracks);
enc->tracks = NULL;
g_free (enc->preamble);
gst_cmml_parser_free (enc->parser);
break;
......
......@@ -221,6 +221,8 @@ gst_cmml_track_list_destroy_track (gchar * key,
void
gst_cmml_track_list_destroy (GHashTable * tracks)
{
g_return_if_fail (tracks != NULL);
g_hash_table_foreach_remove (tracks,
(GHRFunc) gst_cmml_track_list_destroy_track, NULL);
g_hash_table_destroy (tracks);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment