From ef2cc91eb9eb5c61687a32d6225d38befdb52e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 12 Nov 2012 10:08:57 +0100 Subject: [PATCH] vp8dec: Also destroy decoder in set_format() if it was created already Fixes a memory leak. --- ext/vpx/gstvp8dec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/vpx/gstvp8dec.c b/ext/vpx/gstvp8dec.c index 940083b57d..a06968d963 100644 --- a/ext/vpx/gstvp8dec.c +++ b/ext/vpx/gstvp8dec.c @@ -292,13 +292,16 @@ gst_vp8_dec_stop (GstVideoDecoder * base_video_decoder) gst_video_codec_state_unref (gst_vp8_dec->output_state); gst_vp8_dec->output_state = NULL; } + if (gst_vp8_dec->input_state) { gst_video_codec_state_unref (gst_vp8_dec->input_state); gst_vp8_dec->input_state = NULL; } + if (gst_vp8_dec->decoder_inited) vpx_codec_destroy (&gst_vp8_dec->decoder); gst_vp8_dec->decoder_inited = FALSE; + return TRUE; } @@ -308,6 +311,9 @@ gst_vp8_dec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state) GstVP8Dec *gst_vp8_dec = GST_VP8_DEC (decoder); GST_DEBUG_OBJECT (gst_vp8_dec, "set_format"); + + if (decoder->decoder_inited) + vpx_codec_destroy (&decoder->decoder); gst_vp8_dec->decoder_inited = FALSE; if (gst_vp8_dec->input_state)