libavformat: Check for malloc failures in avformat_new_stream
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 9f810a9b37
)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:

committed by
Luca Barbato

parent
883795fb0f
commit
932caa50a5
@@ -2535,6 +2535,11 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
st->codec = avcodec_alloc_context3(c);
|
st->codec = avcodec_alloc_context3(c);
|
||||||
|
if (!st->codec) {
|
||||||
|
av_free(st->info);
|
||||||
|
av_free(st);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
if (s->iformat) {
|
if (s->iformat) {
|
||||||
/* no default bitrate if decoding */
|
/* no default bitrate if decoding */
|
||||||
st->codec->bit_rate = 0;
|
st->codec->bit_rate = 0;
|
||||||
|
Reference in New Issue
Block a user