diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2020-11-29 14:07:43 +0200 |
---|---|---|
committer | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2020-11-29 14:15:51 +0200 |
commit | aba77c64ffe098c4b1a000048adbfe282bb2cb0b (patch) | |
tree | a5b14e7f0eaf38fc892590f1c0ef00f58bc586d1 /video/out | |
parent | 824e569fb56b2f4fbe9296cca2d319a0e33a4e19 (diff) | |
download | mpv-aba77c64ffe098c4b1a000048adbfe282bb2cb0b.tar.bz2 mpv-aba77c64ffe098c4b1a000048adbfe282bb2cb0b.tar.xz |
vo_sixel: don't leak the frame reference
The reference is allocated at reconfig and happens at least once (and
leaked at least once), but can also be called more, e.g. on zoom or
pan-and-scan changes.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/vo_sixel.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/video/out/vo_sixel.c b/video/out/vo_sixel.c index f4ba8db7c7..cc5cc34ecc 100644 --- a/video/out/vo_sixel.c +++ b/video/out/vo_sixel.c @@ -117,7 +117,7 @@ static int detect_scene_change(struct vo* vo) } -static void dealloc_dithers_and_buffer(struct vo* vo) +static void dealloc_dithers_and_buffers(struct vo* vo) { struct priv* priv = vo->priv; @@ -126,6 +126,11 @@ static void dealloc_dithers_and_buffer(struct vo* vo) priv->buffer = NULL; } + if (priv->frame) { + talloc_free(priv->frame); + priv->frame = NULL; + } + if (priv->dither) { sixel_dither_unref(priv->dither); priv->dither = NULL; @@ -288,6 +293,8 @@ static int reconfig(struct vo *vo, struct mp_image_params *params) .p_h = 1, }; + dealloc_dithers_and_buffers(vo); + priv->frame = mp_image_alloc(IMGFMT, priv->width, priv->height); if (!priv->frame) return -1; @@ -299,8 +306,6 @@ static int reconfig(struct vo *vo, struct mp_image_params *params) printf(ESC_CLEAR_SCREEN); vo->want_redraw = true; - dealloc_dithers_and_buffer(vo); - // create testdither only if dynamic palette mode is set if (!priv->opt_fixedpal) { SIXELSTATUS status = sixel_dither_new(&priv->testdither, @@ -483,7 +488,7 @@ static void uninit(struct vo *vo) priv->output = NULL; } - dealloc_dithers_and_buffer(vo); + dealloc_dithers_and_buffers(vo); } #define OPT_BASE_STRUCT struct priv |