From a4eda89b3c83bb96dff068f7af2e3a8319bc3cd5 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Mon, 14 May 2012 17:53:59 +0200 Subject: [PATCH] theoraenc: Don't leak incoming frames (and buffers) We get given a reference in ::handle_frame(), remove it when we're done. --- ext/theora/gsttheoraenc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ext/theora/gsttheoraenc.c b/ext/theora/gsttheoraenc.c index 92965dddbc..8960dfc61a 100644 --- a/ext/theora/gsttheoraenc.c +++ b/ext/theora/gsttheoraenc.c @@ -993,27 +993,28 @@ theora_enc_handle_frame (GstVideoEncoder * benc, GstVideoCodecFrame * frame) while (th_encode_packetout (enc->encoder, 0, &op)) { ret = theora_push_packet (enc, &op); if (ret != GST_FLOW_OK) - goto data_push; + goto beach; } } +beach: + gst_video_codec_frame_unref (frame); return ret; /* ERRORS */ multipass_read_failed: { + gst_video_codec_frame_unref (frame); return ret; } multipass_write_failed: { - return ret; - } -data_push: - { + gst_video_codec_frame_unref (frame); return ret; } encoder_disabled: { + gst_video_codec_frame_unref (frame); GST_ELEMENT_ERROR (enc, STREAM, ENCODE, (NULL), ("libtheora has been compiled with the encoder disabled")); return GST_FLOW_ERROR;