From c57bb51c0323ca27c162e65834fb92b1bd4c07e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 12 Dec 2014 14:56:36 +0000 Subject: [PATCH] tests: audiodecoder: fix broken refcounting in unit test The set_format vfunc does not pass ownership of the caps to the decoder, so we mustn't unref the caps there. gst_event_new_caps() does not take ownership of the caps passed, so we must unref the caps afterwards. Fixes leaks when running test in valgrind in 1.4 branch. --- tests/check/libs/audiodecoder.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/check/libs/audiodecoder.c b/tests/check/libs/audiodecoder.c index c2ef4d2ba8..934b9ddf9a 100644 --- a/tests/check/libs/audiodecoder.c +++ b/tests/check/libs/audiodecoder.c @@ -77,7 +77,6 @@ gst_audio_decoder_tester_set_format (GstAudioDecoder * dec, GstCaps * caps) { GstAudioDecoderTester *tester = (GstAudioDecoderTester *) dec; GstAudioInfo info; - gst_caps_unref (caps); if (!tester->setoutputformat_on_decoding) { caps = gst_caps_new_simple ("audio/x-raw", "format", G_TYPE_STRING, "S32LE", @@ -242,7 +241,7 @@ send_startup_events (void) gst_caps_new_simple ("audio/x-test-custom", "channels", G_TYPE_INT, 2, "rate", G_TYPE_INT, 44100, NULL); fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_caps (caps))); - + gst_caps_unref (caps); } #define NUM_BUFFERS 1000