diff options
author | Ramiro Polla <ramiro.polla@gmail.com> | 2009-09-12 17:22:56 +0000 |
---|---|---|
committer | Ramiro Polla <ramiro.polla@gmail.com> | 2009-09-12 17:22:56 +0000 |
commit | 7ef618796a6f4adf5bb16adce40ccacab0b232b6 (patch) | |
tree | 41449e33a4069167978f21be6ed9a2d567aa8aa7 /ffmpeg.c | |
parent | 600b9c5c8c34df5d0a9116c9c8bf1665235cadc4 (diff) | |
download | ffmpeg-7ef618796a6f4adf5bb16adce40ccacab0b232b6.tar.gz |
Check for return value of some context allocations.
Originally committed as revision 19826 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r-- | ffmpeg.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -483,6 +483,10 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename) st = av_mallocz(sizeof(AVStream)); memcpy(st, ic->streams[i], sizeof(AVStream)); st->codec = avcodec_alloc_context(); + if (!st->codec) { + print_error(filename, AVERROR(ENOMEM)); + av_exit(1); + } memcpy(st->codec, ic->streams[i]->codec, sizeof(AVCodecContext)); s->streams[i] = st; @@ -2836,6 +2840,10 @@ static void opt_input_file(const char *filename) /* get default parameters from command line */ ic = avformat_alloc_context(); + if (!ic) { + print_error(filename, AVERROR(ENOMEM)); + av_exit(1); + } memset(ap, 0, sizeof(*ap)); ap->prealloced_context = 1; @@ -3332,6 +3340,10 @@ static void opt_output_file(const char *filename) filename = "pipe:"; oc = avformat_alloc_context(); + if (!oc) { + print_error(filename, AVERROR(ENOMEM)); + av_exit(1); + } if (!file_oformat) { file_oformat = guess_format(NULL, filename, NULL); |