aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-03-28 10:34:47 +0100
committerAnton Khirnov <anton@khirnov.net>2013-04-04 07:54:45 +0200
commitf8080bd13b5f7fc48204b17fa59a5ce9feb15f07 (patch)
tree5cd107437da1946a17d8878fb2b8d307d48d8ab2
parentd1016dccdcb10486245e5d7c186cc31af54b2a9c (diff)
downloadffmpeg-f8080bd13b5f7fc48204b17fa59a5ce9feb15f07.tar.gz
xmv: do not leak memory in the error paths in xmv_read_header()
CC: libav-stable@libav.org
-rw-r--r--libavformat/xmv.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/xmv.c b/libavformat/xmv.c
index e9b2b0d51e..bc7c3c9410 100644
--- a/libavformat/xmv.c
+++ b/libavformat/xmv.c
@@ -188,8 +188,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];
@@ -230,8 +232,10 @@ static int xmv_read_header(AVFormatContext *s)
}
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;