]> git.sesse.net Git - ffmpeg/commit
avformat/hlsenc: Fix leak of options when initializing muxing fails
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 16 Dec 2019 00:04:06 +0000 (01:04 +0100)
committerSteven Liu <lq@chinaffmpeg.org>
Mon, 23 Dec 2019 06:05:37 +0000 (14:05 +0800)
commit9e4b3ccbb62c29eb1f95af485ec6f0d1e0e4109a
tree43ce605fedc12d1e359b42ee71fd0d35e1962645
parentae84305036ceced3813fb295b71d51343ffd9535
avformat/hlsenc: Fix leak of options when initializing muxing fails

hls_mux_init() currently leaks an AVDictionary if opening a dynamic
buffer fails or if avformat_init_output fails. This has been fixed by
moving the initialization resp. the freeing of the dictionary around:
In the former case to a place after opening the dynamic buffer, in the
latter to a place before the check for initialization failure so that it
is done unconditionally.

Furthermore, the dictionary is now only copied and freed if the options
in it are actually used (namely when in SEGMENT_TYPE_FMP4 mode).

Finally, a similar situation in hls_start() has been fixed, too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Steven Liu <lq@onvideo.cn>
libavformat/hlsenc.c