• Andreas Rheinhardt's avatar
    fftools/ffmpeg_mux_init: Fix double-free on error · ced5c5fd
    Andreas Rheinhardt authored
    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 83ace80b.
    
    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: 's avatarMarth64 <marth64@proxyid.net>
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
    ced5c5fd
Name
Last commit
Last update
..
Makefile Loading commit data...
cmdutils.c Loading commit data...
cmdutils.h Loading commit data...
ffmpeg.c Loading commit data...
ffmpeg.h Loading commit data...
ffmpeg_dec.c Loading commit data...
ffmpeg_demux.c Loading commit data...
ffmpeg_enc.c Loading commit data...
ffmpeg_filter.c Loading commit data...
ffmpeg_hw.c Loading commit data...
ffmpeg_mux.c Loading commit data...
ffmpeg_mux.h Loading commit data...
ffmpeg_mux_init.c Loading commit data...
ffmpeg_opt.c Loading commit data...
ffmpeg_sched.c Loading commit data...
ffmpeg_sched.h Loading commit data...
ffmpeg_utils.h Loading commit data...
ffplay.c Loading commit data...
ffplay_renderer.c Loading commit data...
ffplay_renderer.h Loading commit data...
ffprobe.c Loading commit data...
fftools.manifest Loading commit data...
fftoolsres.rc Loading commit data...
fopen_utf8.h Loading commit data...
objpool.c Loading commit data...
objpool.h Loading commit data...
opt_common.c Loading commit data...
opt_common.h Loading commit data...
sync_queue.c Loading commit data...
sync_queue.h Loading commit data...
thread_queue.c Loading commit data...
thread_queue.h Loading commit data...