FFmpeg/fftools
Andreas Rheinhardt e3b8e3e071
fftools/ffmpeg_mux_init: Fix double-free on error
MATCH_PER_STREAM_OPT iterates over all options of a given
OptionDef and tests whether they apply to the current stream;
if so, they are set to ost->apad, otherwise, the code errors
out. If no error happens, ost->apad is av_strdup'ed in order
to take ownership of this pointer.

But this means that setting it originally was premature,
as it leads to double-frees when an error happens lateron.
This can simply be reproduced with
ffmpeg -filter_complex anullsrc  -apad bar -apad:n baz -f null -
This is a regression since 83ace80bfd.

Fix this by using a temporary variable instead of directly
setting ost->apad. Also only strdup the string if it actually
is != NULL.

Reviewed-by: Marth64 <marth64@proxyid.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
(cherry picked from commit ced5c5fdb8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2025-11-21 20:56:58 +01:00
..
Makefile
cmdutils.c fftools/cmdutils: Add protective () to FLAGS 2024-07-24 16:52:17 +02:00
cmdutils.h
ffmpeg.c fftools/ffmpeg: Check read() for failure 2024-07-24 16:52:25 +02:00
ffmpeg.h fftools/ffmpeg: prefer real errors over EOF in err_merge() 2024-07-24 08:26:13 +02:00
ffmpeg_dec.c
ffmpeg_demux.c fftools/ffmpeg_demux: don't flag timestamps as unreliable if they are generated 2025-07-10 11:19:34 -03:00
ffmpeg_enc.c fftools/ffmpeg_enc: Initialize fd 2024-07-24 16:52:26 +02:00
ffmpeg_filter.c
ffmpeg_hw.c
ffmpeg_mux.c
ffmpeg_mux.h
ffmpeg_mux_init.c fftools/ffmpeg_mux_init: Fix double-free on error 2025-11-21 20:56:58 +01:00
ffmpeg_opt.c
ffplay.c fftools/ffplay: Check return of swr_alloc_set_opts2() 2024-05-25 00:31:15 +02:00
ffprobe.c
fftools.manifest
fftoolsres.rc
fopen_utf8.h
objpool.c
objpool.h
opt_common.c tools/opt_common: Check for malloc failure 2024-05-25 00:31:15 +02:00
opt_common.h
sync_queue.c
sync_queue.h
thread_queue.c
thread_queue.h