]> git.sesse.net Git - ffmpeg/commit
avfilter/vf_paletteuse: Fix potential double-free of AVFrame
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 27 Jan 2020 08:28:20 +0000 (09:28 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 8 Feb 2020 17:20:43 +0000 (18:20 +0100)
commitadea33f46513821c111c602a0692b78315688c1b
tree936122c672057c99fa97af506e35c7609db62fdf
parent4566cfed9c13ee509efb3cc9531ca8965e50c13d
avfilter/vf_paletteuse: Fix potential double-free of AVFrame

apply_palette() would free an AVFrame given to it only via an AVFrame *
(and not via AVFrame **) in three of its four exists (namely in the
normal path and in two error paths). So upon error the caller has no way
to know whether the frame has already been freed or not;
load_apply_palette(), the only caller, opted to free the frame in this
scenario.

This commit changes this by making apply_palette not freeing the frame
at all, which is left to load_apply_palette().

Fixes Coverity issue #1452434.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavfilter/vf_paletteuse.c