video: fix memory leaks with hwdec copy modes

This leaked 2 unreffed AVFrame structs (roughly 1KB) per decoded frame.

Can I blame the FFmpeg API and the weird difference between freeing and
unreffing an AVFrame?
This commit is contained in:
wm4 2017-12-01 07:22:06 +01:00
parent c5fac0c2b0
commit afd5f3227e
1 changed files with 2 additions and 2 deletions

View File

@ -297,9 +297,9 @@ struct mp_image *mp_image_hw_download(struct mp_image *src,
}
int res = av_hwframe_transfer_data(dstav, srcav, 0);
av_frame_unref(srcav);
av_frame_free(&srcav);
dst = mp_image_from_av_frame(dstav);
av_frame_unref(dstav);
av_frame_free(&dstav);
if (res >= 0 && dst) {
mp_image_set_size(dst, src->w, src->h);
mp_image_copy_attributes(dst, src);