xmv: do not leak memory in the error paths in xmv_read_header()
CC: libav-stable@libav.org
(cherry picked from commit f8080bd13b
)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
This commit is contained in:

committed by
Reinhard Tartler

parent
2eaf8698a3
commit
c65fb5b41b
@@ -178,8 +178,10 @@ static int xmv_read_header(AVFormatContext *s,
|
|||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
xmv->audio = av_malloc(xmv->audio_track_count * sizeof(XMVAudioPacket));
|
xmv->audio = av_malloc(xmv->audio_track_count * sizeof(XMVAudioPacket));
|
||||||
if (!xmv->audio)
|
if (!xmv->audio) {
|
||||||
return AVERROR(ENOMEM);
|
ret = AVERROR(ENOMEM);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
for (audio_track = 0; audio_track < xmv->audio_track_count; audio_track++) {
|
for (audio_track = 0; audio_track < xmv->audio_track_count; audio_track++) {
|
||||||
XMVAudioTrack *track = &xmv->audio_tracks[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);
|
"(0x%04X)\n", track->flags);
|
||||||
|
|
||||||
ast = avformat_new_stream(s, NULL);
|
ast = avformat_new_stream(s, NULL);
|
||||||
if (!ast)
|
if (!ast) {
|
||||||
return AVERROR(ENOMEM);
|
ret = AVERROR(ENOMEM);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||||
ast->codec->codec_id = track->codec_id;
|
ast->codec->codec_id = track->codec_id;
|
||||||
|
Reference in New Issue
Block a user