You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avformat/sbgdec: fix leak in sbg_read_header()
In sbg_read_header(), if avformat_new_stream() failed, it returns without cleanup, which may cause memory leaks. Replace return statement with goto so that we would first clean up then return. Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@ -1434,8 +1434,10 @@ static av_cold int sbg_read_header(AVFormatContext *avf)
|
||||
}
|
||||
|
||||
st = avformat_new_stream(avf, NULL);
|
||||
if (!st)
|
||||
return AVERROR(ENOMEM);
|
||||
if (!st) {
|
||||
r = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
sti = ffstream(st);
|
||||
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
st->codecpar->codec_id = AV_CODEC_ID_FFWAVESYNTH;
|
||||
|
Reference in New Issue
Block a user