diff options
author | Sebastian Pölsterl <sebp@k-d-w.org> | 2009-01-04 11:11:06 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2009-01-04 11:11:06 +0000 |
commit | 53514d53a4623da59c6ac5bde73e5054bfe3bf6d (patch) | |
tree | 05575721f081d297e323517c5f9b33adfe531a19 /sys | |
parent | c3060dfb647fbde116918eda3adee183fb7d35b7 (diff) | |
download | gst-plugins-bad-53514d53a4623da59c6ac5bde73e5054bfe3bf6d.tar.gz gst-plugins-bad-53514d53a4623da59c6ac5bde73e5054bfe3bf6d.tar.bz2 gst-plugins-bad-53514d53a4623da59c6ac5bde73e5054bfe3bf6d.zip |
sys/dvb/dvbbasebin.c: Fix some memory leaks. Fixes bug #566356.
Original commit message from CVS:
Patch by: Sebastian Pölsterl <sebp at k-d-w dot org>
* sys/dvb/dvbbasebin.c: (dvb_base_bin_init),
(dvb_base_bin_finalize), (dvb_base_bin_activate_program),
(dvb_base_bin_pmt_info_cb), (dvb_base_bin_pad_added_cb),
(dvb_base_bin_program_destroy):
Fix some memory leaks. Fixes bug #566356.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dvb/dvbbasebin.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/sys/dvb/dvbbasebin.c b/sys/dvb/dvbbasebin.c index e10adab3..4018c7e8 100644 --- a/sys/dvb/dvbbasebin.c +++ b/sys/dvb/dvbbasebin.c @@ -125,6 +125,8 @@ static void dvb_base_bin_rebuild_filter (DvbBaseBin * dvbbasebin); static void dvb_base_bin_uri_handler_init (gpointer g_iface, gpointer iface_data); +static void dvb_base_bin_program_destroy (gpointer data); + static void dvb_base_bin_setup_interfaces (GType type) { @@ -352,7 +354,7 @@ dvb_base_bin_init (DvbBaseBin * dvbbasebin, DvbBaseBinClass * klass) dvbbasebin->buffer_queue, dvbbasebin->mpegtsparse, NULL); dvbbasebin->programs = g_hash_table_new_full (g_direct_hash, g_direct_equal, - NULL, g_free); + NULL, dvb_base_bin_program_destroy); dvbbasebin->streams = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free); @@ -398,6 +400,7 @@ dvb_base_bin_finalize (GObject * object) g_hash_table_destroy (dvbbasebin->streams); g_hash_table_destroy (dvbbasebin->programs); + g_list_free (dvbbasebin->pmtlist); if (G_OBJECT_CLASS (parent_class)->finalize) G_OBJECT_CLASS (parent_class)->finalize (object); @@ -505,8 +508,8 @@ dvb_base_bin_release_pad (GstElement * element, GstPad * pad) ghost = GST_GHOST_PAD (pad); target = gst_ghost_pad_get_target (ghost); - gst_element_release_request_pad (GST_ELEMENT (GST_DVB_BASE_BIN (element)-> - mpegtsparse), target); + gst_element_release_request_pad (GST_ELEMENT (GST_DVB_BASE_BIN + (element)->mpegtsparse), target); gst_object_unref (target); gst_element_remove_pad (element, pad); @@ -924,6 +927,7 @@ dvb_base_bin_pad_added_cb (GstElement * mpegtsparse, { DvbBaseBinProgram *program; gint program_number; + gchar *padname; program_number = get_pad_program_number (pad); if (program_number == -1) @@ -933,13 +937,15 @@ dvb_base_bin_pad_added_cb (GstElement * mpegtsparse, if (program == NULL) program = dvb_base_bin_add_program (dvbbasebin, program_number); program->selected = TRUE; - program->ghost = gst_ghost_pad_new (gst_pad_get_name (pad), pad); + padname = gst_pad_get_name (pad); + program->ghost = gst_ghost_pad_new (padname, pad); gst_pad_set_active (program->ghost, TRUE); gst_element_add_pad (GST_ELEMENT (dvbbasebin), program->ghost); /* if the program has a pmt, activate it now, otherwise it will get activated * when there's a PMT */ if (!program->active && program->pmt_pid != G_MAXUINT16) dvb_base_bin_activate_program (dvbbasebin, program); + g_free (padname); } static void @@ -1028,3 +1034,16 @@ gst_dvb_base_bin_plugin_init (GstPlugin * plugin) return gst_element_register (plugin, "dvbbasebin", GST_RANK_NONE, GST_TYPE_DVB_BASE_BIN); } + +static void +dvb_base_bin_program_destroy (gpointer data) +{ + DvbBaseBinProgram *program; + + program = (DvbBaseBinProgram *) data; + + if (program->pmt) + gst_structure_free (program->pmt); + + g_free (program); +} |