Browse Source

xmv: do not leak memory in the error paths in xmv_read_header()

CC: libav-stable@libav.org
tags/n2.0
Anton Khirnov 12 years ago
parent
commit
f8080bd13b
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      libavformat/xmv.c

+ 8
- 4
libavformat/xmv.c View File

@@ -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;


Loading…
Cancel
Save