[FFmpeg-cvslog] libschroedingerdec: fix leaking of framewithpts
Andreas Cadhalpun
git at videolan.org
Sun Nov 27 01:48:30 EET 2016
ffmpeg | branch: release/2.8 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Sun Nov 13 23:10:06 2016 +0100| [7552f6fc1bbb5d3a7f1d4c1e9ed89ae1f2e2299b] | committer: Andreas Cadhalpun
libschroedingerdec: fix leaking of framewithpts
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
(cherry picked from commit 3c0328d58d98664b05efdd377d3fe66a569d385e)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7552f6fc1bbb5d3a7f1d4c1e9ed89ae1f2e2299b
---
libavcodec/libschroedingerdec.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c
index 96f2731..a4e6934 100644
--- a/libavcodec/libschroedingerdec.c
+++ b/libavcodec/libschroedingerdec.c
@@ -218,6 +218,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx,
int outer = 1;
SchroParseUnitContext parse_ctx;
LibSchroFrameContext *framewithpts = NULL;
+ int ret;
*got_frame = 0;
@@ -308,10 +309,9 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx,
framewithpts = ff_schro_queue_pop(&p_schro_params->dec_frame_queue);
if (framewithpts && framewithpts->frame && framewithpts->frame->components[0].stride) {
- int ret;
if ((ret = ff_get_buffer(avctx, avframe, 0)) < 0)
- return ret;
+ goto end;
memcpy(avframe->data[0],
framewithpts->frame->components[0].data,
@@ -332,15 +332,17 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx,
avframe->linesize[2] = framewithpts->frame->components[2].stride;
*got_frame = 1;
-
- /* Now free the frame resources. */
- libschroedinger_decode_frame_free(framewithpts->frame);
- av_free(framewithpts);
} else {
data = NULL;
*got_frame = 0;
}
- return buf_size;
+ ret = buf_size;
+end:
+ /* Now free the frame resources. */
+ if (framewithpts && framewithpts->frame)
+ libschroedinger_decode_frame_free(framewithpts->frame);
+ av_freep(&framewithpts);
+ return ret;
}
More information about the ffmpeg-cvslog
mailing list