audioencoder: Fix memory leaks in unit test
authorSebastian Dröge <sebastian@centricular.com>
Tue, 15 Apr 2014 09:43:41 +0000 (11:43 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 15 Apr 2014 09:43:41 +0000 (11:43 +0200)
tests/check/libs/audioencoder.c

index b83e2226fa48e61207172c52a52afd47996ac218..a6bfcf04867b3c825e916e3439fbf2855cce1ff9 100644 (file)
@@ -69,9 +69,13 @@ gst_audio_encoder_tester_stop (GstAudioEncoder * enc)
 static gboolean
 gst_audio_encoder_tester_set_format (GstAudioEncoder * enc, GstAudioInfo * info)
 {
-  gst_audio_encoder_set_output_format (enc,
-      gst_caps_new_simple ("audio/x-test-custom", "rate", G_TYPE_INT,
-          TEST_AUDIO_RATE, "channels", G_TYPE_INT, TEST_AUDIO_CHANNELS, NULL));
+  GstCaps *caps;
+
+  caps = gst_caps_new_simple ("audio/x-test-custom", "rate", G_TYPE_INT,
+      TEST_AUDIO_RATE, "channels", G_TYPE_INT, TEST_AUDIO_CHANNELS, NULL);
+  gst_audio_encoder_set_output_format (enc, caps);
+  gst_caps_unref (caps);
+
   return TRUE;
 }
 
@@ -144,12 +148,12 @@ _mysinkpad_event (GstPad * pad, GstObject * parent, GstEvent * event)
 static void
 setup_audioencodertester (void)
 {
-  GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
+  static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
       GST_PAD_SINK,
       GST_PAD_ALWAYS,
       GST_STATIC_CAPS ("audio/x-test-custom")
       );
-  GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+  static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
       GST_PAD_SRC,
       GST_PAD_ALWAYS,
       GST_STATIC_CAPS ("audio/x-raw")