From 824e569fb56b2f4fbe9296cca2d319a0e33a4e19 Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Sun, 29 Nov 2020 14:03:32 +0200 Subject: vo_tct: don't leak the frame reference The reference is allocated at reconfig (and leaked at least once), but could theoretically be called more than once by mpv, or in the future when the tct code is enhanced to hande e.g. pan-and-scan changes. --- video/out/vo_tct.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/video/out/vo_tct.c b/video/out/vo_tct.c index bb7a84f8cb..9325d3cbfa 100644 --- a/video/out/vo_tct.c +++ b/video/out/vo_tct.c @@ -209,6 +209,8 @@ static int reconfig(struct vo *vo, struct mp_image_params *params) }; const int mul = (p->opts->algo == ALGO_PLAIN ? 1 : 2); + if (p->frame) + talloc_free(p->frame); p->frame = mp_image_alloc(IMGFMT, p->swidth, p->sheight * mul); if (!p->frame) return -1; @@ -253,6 +255,9 @@ static void uninit(struct vo *vo) printf(ESC_RESTORE_CURSOR); printf(ESC_CLEAR_SCREEN); printf(ESC_GOTOXY, 0, 0); + struct priv *p = vo->priv; + if (p->frame) + talloc_free(p->frame); } static int preinit(struct vo *vo) -- cgit v1.2.3