Browse Source

avformat/utils: check for malloc failure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a66893ac94)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.4.7
wm4 Michael Niedermayer 11 years ago
parent
commit
b96163f055
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      libavformat/utils.c

+ 5
- 0
libavformat/utils.c View File

@@ -3610,6 +3610,11 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
st->info->last_dts = AV_NOPTS_VALUE; st->info->last_dts = AV_NOPTS_VALUE;


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;


Loading…
Cancel
Save