[FFmpeg-cvslog] avformat/smoothstreaming: Fix memleaks on errors
ffmpeg | branch: release/3.2 | Andreas Rheinhardt | Thu Dec 26 11:53:28 2019 +0100| [d63495c692478a57c66ddc1881b22878dc602e2d] | committer: Andreas Rheinhardt avformat/smoothstreaming: Fix memleaks on errors If an AVFormatContext could be allocated, but white-/blacklists couldn't be copied, the AVFormatContext would leak as it was only accessible through a local variable that goes out of scope when one goes to fail. Furthermore, in case writing a header of a submuxer failed, the options used for said call could leak. Both of these memleaks have been fixed. Signed-off-by: Andreas Rheinhardt Signed-off-by: Michael Niedermayer (cherry picked from commit abbb466368c51285ca27d5e3959a16a9591e9a4c) Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d63495c692478a57c66ddc1881b22878dc602e2d --- libavformat/smoothstreamingenc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index dabd1ea304..793b8b79d1 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -331,12 +331,11 @@ static int ism_write_header(AVFormatContext *s) goto fail; } -ctx = avformat_alloc_context(); +os->ctx = ctx = avformat_alloc_context(); if (!ctx || ff_copy_whiteblacklists(ctx, s) < 0) { ret = AVERROR(ENOMEM); goto fail; } -os->ctx = ctx; ctx->oformat = oformat; ctx->interrupt_callback = s->interrupt_callback; @@ -356,12 +355,13 @@ static int ism_write_header(AVFormatContext *s) av_dict_set_int(, "ism_lookahead", c->lookahead_count, 0); av_dict_set(, "movflags", "frag_custom", 0); -if ((ret = avformat_write_header(ctx, )) < 0) { +ret = avformat_write_header(ctx, ); +av_dict_free(); +if (ret < 0) { goto fail; } os->ctx_inited = 1; avio_flush(ctx->pb); -av_dict_free(); s->streams[i]->time_base = st->time_base; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { c->has_video = 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/smoothstreaming: Fix memleaks on errors
ffmpeg | branch: release/3.3 | Andreas Rheinhardt | Thu Dec 26 11:53:28 2019 +0100| [98efb7afc9e6bace65aeb73d7d9c2001bbf0009d] | committer: Andreas Rheinhardt avformat/smoothstreaming: Fix memleaks on errors If an AVFormatContext could be allocated, but white-/blacklists couldn't be copied, the AVFormatContext would leak as it was only accessible through a local variable that goes out of scope when one goes to fail. Furthermore, in case writing a header of a submuxer failed, the options used for said call could leak. Both of these memleaks have been fixed. Signed-off-by: Andreas Rheinhardt Signed-off-by: Michael Niedermayer (cherry picked from commit abbb466368c51285ca27d5e3959a16a9591e9a4c) Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=98efb7afc9e6bace65aeb73d7d9c2001bbf0009d --- libavformat/smoothstreamingenc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index dabd1ea304..793b8b79d1 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -331,12 +331,11 @@ static int ism_write_header(AVFormatContext *s) goto fail; } -ctx = avformat_alloc_context(); +os->ctx = ctx = avformat_alloc_context(); if (!ctx || ff_copy_whiteblacklists(ctx, s) < 0) { ret = AVERROR(ENOMEM); goto fail; } -os->ctx = ctx; ctx->oformat = oformat; ctx->interrupt_callback = s->interrupt_callback; @@ -356,12 +355,13 @@ static int ism_write_header(AVFormatContext *s) av_dict_set_int(, "ism_lookahead", c->lookahead_count, 0); av_dict_set(, "movflags", "frag_custom", 0); -if ((ret = avformat_write_header(ctx, )) < 0) { +ret = avformat_write_header(ctx, ); +av_dict_free(); +if (ret < 0) { goto fail; } os->ctx_inited = 1; avio_flush(ctx->pb); -av_dict_free(); s->streams[i]->time_base = st->time_base; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { c->has_video = 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/smoothstreaming: Fix memleaks on errors
ffmpeg | branch: release/3.4 | Andreas Rheinhardt | Thu Dec 26 11:53:28 2019 +0100| [d7fa4cadeaa5e2a33624a73fed1b10b79c75201b] | committer: Andreas Rheinhardt avformat/smoothstreaming: Fix memleaks on errors If an AVFormatContext could be allocated, but white-/blacklists couldn't be copied, the AVFormatContext would leak as it was only accessible through a local variable that goes out of scope when one goes to fail. Furthermore, in case writing a header of a submuxer failed, the options used for said call could leak. Both of these memleaks have been fixed. Signed-off-by: Andreas Rheinhardt Signed-off-by: Michael Niedermayer (cherry picked from commit abbb466368c51285ca27d5e3959a16a9591e9a4c) Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d7fa4cadeaa5e2a33624a73fed1b10b79c75201b --- libavformat/smoothstreamingenc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index 54a1c49caa..0349d6297b 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -331,12 +331,11 @@ static int ism_write_header(AVFormatContext *s) goto fail; } -ctx = avformat_alloc_context(); +os->ctx = ctx = avformat_alloc_context(); if (!ctx || ff_copy_whiteblacklists(ctx, s) < 0) { ret = AVERROR(ENOMEM); goto fail; } -os->ctx = ctx; ctx->oformat = oformat; ctx->interrupt_callback = s->interrupt_callback; @@ -356,12 +355,13 @@ static int ism_write_header(AVFormatContext *s) av_dict_set_int(, "ism_lookahead", c->lookahead_count, 0); av_dict_set(, "movflags", "frag_custom", 0); -if ((ret = avformat_write_header(ctx, )) < 0) { +ret = avformat_write_header(ctx, ); +av_dict_free(); +if (ret < 0) { goto fail; } os->ctx_inited = 1; avio_flush(ctx->pb); -av_dict_free(); s->streams[i]->time_base = st->time_base; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { c->has_video = 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/smoothstreaming: Fix memleaks on errors
ffmpeg | branch: release/4.0 | Andreas Rheinhardt | Thu Dec 26 11:53:28 2019 +0100| [27c4e7d99c009977a622743afdef40fdeefcc98b] | committer: Andreas Rheinhardt avformat/smoothstreaming: Fix memleaks on errors If an AVFormatContext could be allocated, but white-/blacklists couldn't be copied, the AVFormatContext would leak as it was only accessible through a local variable that goes out of scope when one goes to fail. Furthermore, in case writing a header of a submuxer failed, the options used for said call could leak. Both of these memleaks have been fixed. Signed-off-by: Andreas Rheinhardt Signed-off-by: Michael Niedermayer (cherry picked from commit abbb466368c51285ca27d5e3959a16a9591e9a4c) Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=27c4e7d99c009977a622743afdef40fdeefcc98b --- libavformat/smoothstreamingenc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index 094712af27..b0687a85f8 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -331,12 +331,11 @@ static int ism_write_header(AVFormatContext *s) goto fail; } -ctx = avformat_alloc_context(); +os->ctx = ctx = avformat_alloc_context(); if (!ctx || ff_copy_whiteblacklists(ctx, s) < 0) { ret = AVERROR(ENOMEM); goto fail; } -os->ctx = ctx; ctx->oformat = oformat; ctx->interrupt_callback = s->interrupt_callback; @@ -356,12 +355,13 @@ static int ism_write_header(AVFormatContext *s) av_dict_set_int(, "ism_lookahead", c->lookahead_count, 0); av_dict_set(, "movflags", "frag_custom", 0); -if ((ret = avformat_write_header(ctx, )) < 0) { +ret = avformat_write_header(ctx, ); +av_dict_free(); +if (ret < 0) { goto fail; } os->ctx_inited = 1; avio_flush(ctx->pb); -av_dict_free(); s->streams[i]->time_base = st->time_base; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { c->has_video = 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/smoothstreaming: Fix memleaks on errors
ffmpeg | branch: release/4.1 | Andreas Rheinhardt | Thu Dec 26 11:53:28 2019 +0100| [cfb42ce4155f10b94c31cb08eaa0582a4333eaeb] | committer: Andreas Rheinhardt avformat/smoothstreaming: Fix memleaks on errors If an AVFormatContext could be allocated, but white-/blacklists couldn't be copied, the AVFormatContext would leak as it was only accessible through a local variable that goes out of scope when one goes to fail. Furthermore, in case writing a header of a submuxer failed, the options used for said call could leak. Both of these memleaks have been fixed. Signed-off-by: Andreas Rheinhardt Signed-off-by: Michael Niedermayer (cherry picked from commit abbb466368c51285ca27d5e3959a16a9591e9a4c) Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cfb42ce4155f10b94c31cb08eaa0582a4333eaeb --- libavformat/smoothstreamingenc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index 094712af27..b0687a85f8 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -331,12 +331,11 @@ static int ism_write_header(AVFormatContext *s) goto fail; } -ctx = avformat_alloc_context(); +os->ctx = ctx = avformat_alloc_context(); if (!ctx || ff_copy_whiteblacklists(ctx, s) < 0) { ret = AVERROR(ENOMEM); goto fail; } -os->ctx = ctx; ctx->oformat = oformat; ctx->interrupt_callback = s->interrupt_callback; @@ -356,12 +355,13 @@ static int ism_write_header(AVFormatContext *s) av_dict_set_int(, "ism_lookahead", c->lookahead_count, 0); av_dict_set(, "movflags", "frag_custom", 0); -if ((ret = avformat_write_header(ctx, )) < 0) { +ret = avformat_write_header(ctx, ); +av_dict_free(); +if (ret < 0) { goto fail; } os->ctx_inited = 1; avio_flush(ctx->pb); -av_dict_free(); s->streams[i]->time_base = st->time_base; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { c->has_video = 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/smoothstreaming: Fix memleaks on errors
ffmpeg | branch: release/4.2 | Andreas Rheinhardt | Thu Dec 26 11:53:28 2019 +0100| [5efb7dc2b2e437b201d3e6e28b2d2c7e121dc28b] | committer: Andreas Rheinhardt avformat/smoothstreaming: Fix memleaks on errors If an AVFormatContext could be allocated, but white-/blacklists couldn't be copied, the AVFormatContext would leak as it was only accessible through a local variable that goes out of scope when one goes to fail. Furthermore, in case writing a header of a submuxer failed, the options used for said call could leak. Both of these memleaks have been fixed. Signed-off-by: Andreas Rheinhardt Signed-off-by: Michael Niedermayer (cherry picked from commit abbb466368c51285ca27d5e3959a16a9591e9a4c) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5efb7dc2b2e437b201d3e6e28b2d2c7e121dc28b --- libavformat/smoothstreamingenc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index 1ed19ebb2f..78c340 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -333,12 +333,11 @@ static int ism_write_header(AVFormatContext *s) goto fail; } -ctx = avformat_alloc_context(); +os->ctx = ctx = avformat_alloc_context(); if (!ctx || ff_copy_whiteblacklists(ctx, s) < 0) { ret = AVERROR(ENOMEM); goto fail; } -os->ctx = ctx; ctx->oformat = oformat; ctx->interrupt_callback = s->interrupt_callback; @@ -358,12 +357,13 @@ static int ism_write_header(AVFormatContext *s) av_dict_set_int(, "ism_lookahead", c->lookahead_count, 0); av_dict_set(, "movflags", "frag_custom", 0); -if ((ret = avformat_write_header(ctx, )) < 0) { +ret = avformat_write_header(ctx, ); +av_dict_free(); +if (ret < 0) { goto fail; } os->ctx_inited = 1; avio_flush(ctx->pb); -av_dict_free(); s->streams[i]->time_base = st->time_base; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { c->has_video = 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/smoothstreaming: Fix memleaks on errors
ffmpeg | branch: master | Andreas Rheinhardt | Thu Dec 26 11:53:28 2019 +0100| [abbb466368c51285ca27d5e3959a16a9591e9a4c] | committer: Michael Niedermayer avformat/smoothstreaming: Fix memleaks on errors If an AVFormatContext could be allocated, but white-/blacklists couldn't be copied, the AVFormatContext would leak as it was only accessible through a local variable that goes out of scope when one goes to fail. Furthermore, in case writing a header of a submuxer failed, the options used for said call could leak. Both of these memleaks have been fixed. Signed-off-by: Andreas Rheinhardt Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=abbb466368c51285ca27d5e3959a16a9591e9a4c --- libavformat/smoothstreamingenc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c index 2faf1e7897..0e4f531f90 100644 --- a/libavformat/smoothstreamingenc.c +++ b/libavformat/smoothstreamingenc.c @@ -332,12 +332,11 @@ static int ism_write_header(AVFormatContext *s) goto fail; } -ctx = avformat_alloc_context(); +os->ctx = ctx = avformat_alloc_context(); if (!ctx || ff_copy_whiteblacklists(ctx, s) < 0) { ret = AVERROR(ENOMEM); goto fail; } -os->ctx = ctx; ctx->oformat = oformat; ctx->interrupt_callback = s->interrupt_callback; @@ -357,12 +356,13 @@ static int ism_write_header(AVFormatContext *s) av_dict_set_int(, "ism_lookahead", c->lookahead_count, 0); av_dict_set(, "movflags", "frag_custom", 0); -if ((ret = avformat_write_header(ctx, )) < 0) { +ret = avformat_write_header(ctx, ); +av_dict_free(); +if (ret < 0) { goto fail; } os->ctx_inited = 1; avio_flush(ctx->pb); -av_dict_free(); s->streams[i]->time_base = st->time_base; if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { c->has_video = 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".