From c76f4fe3ef60644d3885d7a1eb43e2d66261078b Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Thu, 7 Jun 2012 12:33:31 +0100 Subject: [PATCH] [MOVED FROM BAD 114/134] vp8: fix codec state leaks I only tested that vp8enc ! vp8dec does not crash, as valgrind does not grok at least one of the instructions used by vp8enc, preventing me from checking a leak, and the lack of one after the patch. --- ext/vp8/gstvp8dec.c | 4 ++++ ext/vp8/gstvp8enc.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/ext/vp8/gstvp8dec.c b/ext/vp8/gstvp8dec.c index 782244e0dc..52e0f5fe21 100644 --- a/ext/vp8/gstvp8dec.c +++ b/ext/vp8/gstvp8dec.c @@ -316,6 +316,10 @@ gst_vp8_dec_reset (GstVideoDecoder * base_video_decoder, gboolean hard) gst_video_codec_state_unref (decoder->output_state); decoder->output_state = NULL; } + if (hard && decoder->input_state) { + gst_video_codec_state_unref (decoder->input_state); + decoder->input_state = NULL; + } if (decoder->decoder_inited) vpx_codec_destroy (&decoder->decoder); decoder->decoder_inited = FALSE; diff --git a/ext/vp8/gstvp8enc.c b/ext/vp8/gstvp8enc.c index 2817f21751..0454dae079 100644 --- a/ext/vp8/gstvp8enc.c +++ b/ext/vp8/gstvp8enc.c @@ -488,6 +488,9 @@ gst_vp8_enc_finalize (GObject * object) g_free (gst_vp8_enc->multipass_cache_file); gst_vp8_enc->multipass_cache_file = NULL; + if (gst_vp8_enc->input_state) + gst_video_codec_state_unref (gst_vp8_enc->input_state); + G_OBJECT_CLASS (parent_class)->finalize (object); }