diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-03-28 10:34:47 +0100 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2013-04-24 21:01:14 +0200 |
commit | c65fb5b41b8e7a11a8ef472eba88c9ff08ce097e (patch) | |
tree | b723c710d19c6b25c86429a944c6e0d6fc6b43dd | |
parent | 2eaf8698a3bb3ef01af8da8fada6437dae4a2ba5 (diff) | |
download | ffmpeg-c65fb5b41b8e7a11a8ef472eba88c9ff08ce097e.tar.gz |
xmv: do not leak memory in the error paths in xmv_read_header()
CC: libav-stable@libav.org
(cherry picked from commit f8080bd13b5f7fc48204b17fa59a5ce9feb15f07)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
-rw-r--r-- | libavformat/xmv.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/xmv.c b/libavformat/xmv.c index bc4b23917a..ee4aec3c96 100644 --- a/libavformat/xmv.c +++ b/libavformat/xmv.c @@ -178,8 +178,10 @@ static int xmv_read_header(AVFormatContext *s, return AVERROR(ENOMEM); xmv->audio = av_malloc(xmv->audio_track_count * sizeof(XMVAudioPacket)); - if (!xmv->audio) - return AVERROR(ENOMEM); + if (!xmv->audio) { + ret = AVERROR(ENOMEM); + goto fail; + } for (audio_track = 0; audio_track < xmv->audio_track_count; audio_track++) { XMVAudioTrack *track = &xmv->audio_tracks[audio_track]; @@ -213,8 +215,10 @@ static int xmv_read_header(AVFormatContext *s, "(0x%04X)\n", track->flags); ast = avformat_new_stream(s, NULL); - if (!ast) - return AVERROR(ENOMEM); + if (!ast) { + ret = AVERROR(ENOMEM); + goto fail; + } ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_id = track->codec_id; |