aiffparse: don't leak adapter
authorTim-Philipp Müller <tim@centricular.net>
Fri, 16 Aug 2013 23:23:08 +0000 (00:23 +0100)
committerTim-Philipp Müller <tim@centricular.net>
Fri, 16 Aug 2013 23:25:49 +0000 (00:25 +0100)
gst/aiff/aiffparse.c

index 183e0b9e100c7f792357a52a41836ae17d6dd09f..eaa1b819e985db29d5154aff0b3043c218cfbd44 100644 (file)
@@ -1645,13 +1645,17 @@ gst_aiff_parse_sink_activate_mode (GstPad * sinkpad, GstObject * parent,
   gboolean res;
   GstAiffParse *aiff = GST_AIFF_PARSE (parent);
 
-  if (aiff->adapter)
+  if (aiff->adapter) {
     g_object_unref (aiff->adapter);
+    aiff->adapter = NULL;
+  }
 
   switch (mode) {
     case GST_PAD_MODE_PUSH:
-      aiff->streaming = TRUE;
-      aiff->adapter = gst_adapter_new ();
+      if (active) {
+        aiff->streaming = TRUE;
+        aiff->adapter = gst_adapter_new ();
+      }
       res = TRUE;
       break;
     case GST_PAD_MODE_PULL: