summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2019-08-20 10:29:04 +0800
committerSteven Liu <lq@chinaffmpeg.org>2019-08-21 16:46:28 +0800
commitd1fe1344ea9890a29badd3ff48b600eb5225dca8 (patch)
tree4ccf72dc64ee9c13c9324b823124ceb281e9fd58 /libavformat
parent661a9b274b0181b2e36ff21fd13840f35992bea6 (diff)
avformat/hlsenc: fix memleak in update_variant_stream_info
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/hlsenc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 836e290eea..c740cf2c56 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -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].streams = av_mallocz(sizeof(AVStream *) *
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);
+ }
//by default, the first available ccgroup is mapped to the variant stream
if (hls->nb_ccstreams) {
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);
+ }
}
for (i = 0; i < s->nb_streams; i++)