Commit d1fe1344 authored by Steven Liu's avatar Steven Liu

avformat/hlsenc: fix memleak in update_variant_stream_info

Signed-off-by: 's avatarSteven Liu <lq@chinaffmpeg.org>
parent 661a9b27
...@@ -2131,14 +2131,18 @@ static int update_variant_stream_info(AVFormatContext *s) { ...@@ -2131,14 +2131,18 @@ static int update_variant_stream_info(AVFormatContext *s) {
hls->var_streams[0].nb_streams = s->nb_streams; hls->var_streams[0].nb_streams = s->nb_streams;
hls->var_streams[0].streams = av_mallocz(sizeof(AVStream *) * hls->var_streams[0].streams = av_mallocz(sizeof(AVStream *) *
hls->var_streams[0].nb_streams); hls->var_streams[0].nb_streams);
if (!hls->var_streams[0].streams) if (!hls->var_streams[0].streams) {
av_free(hls->var_streams);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
}
//by default, the first available ccgroup is mapped to the variant stream //by default, the first available ccgroup is mapped to the variant stream
if (hls->nb_ccstreams) { if (hls->nb_ccstreams) {
hls->var_streams[0].ccgroup = av_strdup(hls->cc_streams[0].ccgroup); hls->var_streams[0].ccgroup = av_strdup(hls->cc_streams[0].ccgroup);
if (!hls->var_streams[0].ccgroup) if (!hls->var_streams[0].ccgroup) {
av_free(hls->var_streams);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
}
} }
for (i = 0; i < s->nb_streams; i++) for (i = 0; i < s->nb_streams; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment