Commit 3c0328d5 authored by Andreas Cadhalpun's avatar Andreas Cadhalpun

libschroedingerdec: fix leaking of framewithpts

Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent a86ebbf7
...@@ -218,6 +218,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx, ...@@ -218,6 +218,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx,
int outer = 1; int outer = 1;
SchroParseUnitContext parse_ctx; SchroParseUnitContext parse_ctx;
LibSchroFrameContext *framewithpts = NULL; LibSchroFrameContext *framewithpts = NULL;
int ret;
*got_frame = 0; *got_frame = 0;
...@@ -308,10 +309,9 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx, ...@@ -308,10 +309,9 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx,
framewithpts = ff_schro_queue_pop(&p_schro_params->dec_frame_queue); framewithpts = ff_schro_queue_pop(&p_schro_params->dec_frame_queue);
if (framewithpts && framewithpts->frame && framewithpts->frame->components[0].stride) { if (framewithpts && framewithpts->frame && framewithpts->frame->components[0].stride) {
int ret;
if ((ret = ff_get_buffer(avctx, avframe, 0)) < 0) if ((ret = ff_get_buffer(avctx, avframe, 0)) < 0)
return ret; goto end;
memcpy(avframe->data[0], memcpy(avframe->data[0],
framewithpts->frame->components[0].data, framewithpts->frame->components[0].data,
...@@ -337,15 +337,17 @@ FF_ENABLE_DEPRECATION_WARNINGS ...@@ -337,15 +337,17 @@ FF_ENABLE_DEPRECATION_WARNINGS
avframe->linesize[2] = framewithpts->frame->components[2].stride; avframe->linesize[2] = framewithpts->frame->components[2].stride;
*got_frame = 1; *got_frame = 1;
/* Now free the frame resources. */
libschroedinger_decode_frame_free(framewithpts->frame);
av_free(framewithpts);
} else { } else {
data = NULL; data = NULL;
*got_frame = 0; *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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment