[FFmpeg-devel] [PATCH 1/2] avfilter/vf_scale: fix frame lifetimes

Michael Niedermayer michael at niedermayer.cc
Wed Jul 10 15:29:46 EEST 2024


On Tue, Jul 09, 2024 at 11:34:36AM +0200, Niklas Haas wrote:
> From: Niklas Haas <git at haasn.dev>
> 
> scale_frame() inconsistently handled the lifetime of `in`. Fixes a
> possible double free and a possible memory leak.
> 
> The new code always has `scale_frame` take over ownership of the input
> frame. I first tried writing this code in a way where the calling code
> retains ownership, but this is nontrivial due to the presence of the
> no-op short-circuit condition in which the input frame is directly
> returned. (As an alternative, we could use av_frame_clone() instead, but
> I wanted to avoid touching the original behavior in this commit)
> ---
>  libavfilter/vf_scale.c | 29 +++++++++++++++++------------
>  1 file changed, 17 insertions(+), 12 deletions(-)

patchset LGTM

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240710/0a8cdeda/attachment.sig>


More information about the ffmpeg-devel mailing list