[FFmpeg-cvslog] opus_parser: fix leaking channel_maps on error
Andreas Cadhalpun
git at videolan.org
Sat Dec 10 14:38:45 EET 2016
ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Fri Dec 9 00:00:18 2016 +0100| [7d3baebe408cb7377dbb6fa1a7fd285e8e366440] | committer: Andreas Cadhalpun
opus_parser: fix leaking channel_maps on error
Make ff_opus_parse_extradata free allocated memory on error instead of
expecting callers to free it in that case.
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d3baebe408cb7377dbb6fa1a7fd285e8e366440
---
libavcodec/opus.c | 1 +
libavcodec/opusdec.c | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/opus.c b/libavcodec/opus.c
index 08d94b6..1eeb92c 100644
--- a/libavcodec/opus.c
+++ b/libavcodec/opus.c
@@ -403,6 +403,7 @@ av_cold int ff_opus_parse_extradata(AVCodecContext *avctx,
} else if (idx >= streams + stereo_streams) {
av_log(avctx, AV_LOG_ERROR,
"Invalid channel map for output channel %d: %d\n", i, idx);
+ av_freep(&s->channel_maps);
return AVERROR_INVALIDDATA;
}
diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c
index ec793c6..329f784 100644
--- a/libavcodec/opusdec.c
+++ b/libavcodec/opusdec.c
@@ -646,7 +646,6 @@ static av_cold int opus_decode_init(AVCodecContext *avctx)
/* find out the channel configuration */
ret = ff_opus_parse_extradata(avctx, c);
if (ret < 0) {
- av_freep(&c->channel_maps);
av_freep(&c->fdsp);
return ret;
}
More information about the ffmpeg-cvslog
mailing list