ext/amrnb/amrnbdec.c: Don't leak the adapter, unref it in a new finalize method instead.

Original commit message from CVS:
Patch by: Laurent Glayal <spglegle at yahoo dot fr>
* ext/amrnb/amrnbdec.c: (gst_amrnbdec_class_init),
(gst_amrnbdec_finalize):
Don't leak the adapter, unref it in a new finalize method instead.
Fixes #448782.
This commit is contained in:
Laurent Glayal 2007-06-19 14:15:50 +00:00 committed by Wim Taymans
parent 3692373654
commit 3c563fd3ae
2 changed files with 27 additions and 0 deletions

View file

@ -1,3 +1,12 @@
2007-06-19 Wim Taymans <wim@fluendo.com>
Patch by: Laurent Glayal <spglegle at yahoo dot fr>
* ext/amrnb/amrnbdec.c: (gst_amrnbdec_class_init),
(gst_amrnbdec_finalize):
Don't leak the adapter, unref it in a new finalize method instead.
Fixes #448782.
2007-06-19 Jan Schmidt <thaytan@mad.scientist.com> 2007-06-19 Jan Schmidt <thaytan@mad.scientist.com>
* configure.ac: * configure.ac:

View file

@ -53,6 +53,8 @@ static gboolean gst_amrnbdec_setcaps (GstPad * pad, GstCaps * caps);
static GstStateChangeReturn gst_amrnbdec_state_change (GstElement * element, static GstStateChangeReturn gst_amrnbdec_state_change (GstElement * element,
GstStateChange transition); GstStateChange transition);
static void gst_amrnbdec_finalize (GObject * object);
#define _do_init(bla) \ #define _do_init(bla) \
GST_DEBUG_CATEGORY_INIT (gst_amrnbdec_debug, "amrnbdec", 0, "AMR-NB audio decoder"); GST_DEBUG_CATEGORY_INIT (gst_amrnbdec_debug, "amrnbdec", 0, "AMR-NB audio decoder");
@ -79,8 +81,11 @@ gst_amrnbdec_base_init (gpointer klass)
static void static void
gst_amrnbdec_class_init (GstAmrnbDecClass * klass) gst_amrnbdec_class_init (GstAmrnbDecClass * klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
object_class->finalize = gst_amrnbdec_finalize;
element_class->change_state = GST_DEBUG_FUNCPTR (gst_amrnbdec_state_change); element_class->change_state = GST_DEBUG_FUNCPTR (gst_amrnbdec_state_change);
} }
@ -109,6 +114,19 @@ gst_amrnbdec_init (GstAmrnbDec * amrnbdec, GstAmrnbDecClass * klass)
amrnbdec->handle = NULL; amrnbdec->handle = NULL;
} }
static void
gst_amrnbdec_finalize (GObject * object)
{
GstAmrnbDec *amrnbdec;
amrnbdec = GST_AMRNBDEC (object);
gst_adapter_clear (amrnbdec->adapter);
g_object_unref (amrnbdec->adapter);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean static gboolean
gst_amrnbdec_setcaps (GstPad * pad, GstCaps * caps) gst_amrnbdec_setcaps (GstPad * pad, GstCaps * caps)
{ {