From 902424d065bab52185fc2d0b177ce75012e71819 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 11 Jan 2017 08:27:46 +0100 Subject: vd_lavc: fix some leaks and a discarded frame on hwdec fallback Wasn't a problem in most normal scenarios. --- video/decode/vd_lavc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 1753bdedda..9b65912fe4 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -868,8 +868,10 @@ static bool send_packet(struct dec_video *vd, struct demux_packet *pkt) vd_ffmpeg_ctx *ctx = vd->priv; if (ctx->num_requeue_packets) { - if (do_send_packet(vd, ctx->requeue_packets[0])) + if (do_send_packet(vd, ctx->requeue_packets[0])) { + talloc_free(ctx->requeue_packets[0]); MP_TARRAY_REMOVE_AT(ctx->requeue_packets, ctx->num_requeue_packets, 0); + } return false; } @@ -969,6 +971,9 @@ static struct mp_image *receive_frame(struct dec_video *vd) ctx->requeue_packets = pkts; ctx->num_requeue_packets = num_pkts; + + if (img) + return img; } return read_output(vd, eof); -- cgit v1.2.3