From 059420b678a00d503a772c35bebb41877c1c50a1 Mon Sep 17 00:00:00 2001 From: Deepak Srivastava Date: Thu, 10 Aug 2017 15:14:31 +0530 Subject: [PATCH] wavparse: Fix memory leak in wavparse element Fixing of leaking the text field of the GstWavParseNote and GstWavParseLabl structure. https://bugzilla.gnome.org/show_bug.cgi?id=785429 --- gst/wavparse/gstwavparse.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c index e2224a581b..d8fad3917f 100644 --- a/gst/wavparse/gstwavparse.c +++ b/gst/wavparse/gstwavparse.c @@ -193,6 +193,22 @@ gst_wavparse_class_init (GstWavParseClass * klass) "Erik Walthinsen "); } +static void +gst_wavparse_notes_free (GstWavParseNote * note) +{ + if (note) + g_free (note->text); + g_free (note); +} + +static void +gst_wavparse_labls_free (GstWavParseLabl * labl) +{ + if (labl) + g_free (labl->text); + g_free (labl); +} + static void gst_wavparse_reset (GstWavParse * wav) { @@ -233,8 +249,11 @@ gst_wavparse_reset (GstWavParse * wav) g_list_free_full (wav->cues, g_free); wav->cues = NULL; if (wav->labls) - g_list_free_full (wav->labls, g_free); + g_list_free_full (wav->labls, (GDestroyNotify) gst_wavparse_labls_free); wav->labls = NULL; + if (wav->notes) + g_list_free_full (wav->notes, (GDestroyNotify) gst_wavparse_notes_free); + wav->notes = NULL; if (wav->caps) gst_caps_unref (wav->caps); wav->caps = NULL;