mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-13 19:44:10 +00:00
alsamidisrc: free ports during finalize()
If the element is never start/stopped the ports variable will leak. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8648>
This commit is contained in:
parent
ecccd6a8cf
commit
a7dce91f0d
1 changed files with 12 additions and 1 deletions
|
@ -308,6 +308,7 @@ G_DEFINE_TYPE_WITH_CODE (GstAlsaMidiSrc, gst_alsa_midi_src, GST_TYPE_PUSH_SRC,
|
|||
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (alsamidisrc, "alsamidisrc",
|
||||
GST_RANK_PRIMARY, GST_TYPE_ALSA_MIDI_SRC, alsa_element_init (plugin));
|
||||
|
||||
static void gst_alsa_midi_src_finalize (GObject * object);
|
||||
static void gst_alsa_midi_src_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
static void gst_alsa_midi_src_get_property (GObject * object, guint prop_id,
|
||||
|
@ -336,6 +337,7 @@ gst_alsa_midi_src_class_init (GstAlsaMidiSrcClass * klass)
|
|||
gstbase_src_class = GST_BASE_SRC_CLASS (klass);
|
||||
gstpush_src_class = GST_PUSH_SRC_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gst_alsa_midi_src_finalize;
|
||||
gobject_class->set_property = gst_alsa_midi_src_set_property;
|
||||
gobject_class->get_property = gst_alsa_midi_src_get_property;
|
||||
|
||||
|
@ -369,6 +371,16 @@ gst_alsa_midi_src_init (GstAlsaMidiSrc * alsamidisrc)
|
|||
gst_base_src_set_live (GST_BASE_SRC (alsamidisrc), TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_alsa_midi_src_finalize (GObject * object)
|
||||
{
|
||||
GstAlsaMidiSrc *src = GST_ALSA_MIDI_SRC (object);
|
||||
|
||||
g_free (src->ports);
|
||||
|
||||
G_OBJECT_CLASS (gst_alsa_midi_src_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_alsa_midi_src_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
|
@ -621,7 +633,6 @@ gst_alsa_midi_src_stop (GstBaseSrc * basesrc)
|
|||
gst_poll_free (alsamidisrc->poll);
|
||||
alsamidisrc->poll = NULL;
|
||||
}
|
||||
g_free (alsamidisrc->ports);
|
||||
g_free (alsamidisrc->buffer);
|
||||
snd_midi_event_free (alsamidisrc->parser);
|
||||
g_free (alsamidisrc->seq_ports);
|
||||
|
|
Loading…
Reference in a new issue