mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avformat/avidec: Fix memleak when allocating DVDemuxContext fails
An AVIStream (intended to be used as private data for an AVStream) would leak in this scenario. Also return a more fitting error code instead of AVERROR_INVALIDDATA. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
2084ea8c1d
commit
de0b04551d
@ -605,9 +605,12 @@ static int avi_read_header(AVFormatContext *s)
|
|||||||
ast = s->streams[0]->priv_data;
|
ast = s->streams[0]->priv_data;
|
||||||
st->priv_data = NULL;
|
st->priv_data = NULL;
|
||||||
ff_free_stream(s, st);
|
ff_free_stream(s, st);
|
||||||
avi->dv_demux = avpriv_dv_init_demux(s);
|
|
||||||
if (!avi->dv_demux)
|
avi->dv_demux = avpriv_dv_init_demux(s);
|
||||||
goto fail;
|
if (!avi->dv_demux) {
|
||||||
|
av_free(ast);
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
|
|
||||||
s->streams[0]->priv_data = ast;
|
s->streams[0]->priv_data = ast;
|
||||||
avio_skip(pb, 3 * 4);
|
avio_skip(pb, 3 * 4);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user