diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2009-06-21 20:13:54 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2009-06-21 20:13:54 +0000 |
commit | e9a32230c3e05deff257cbfa1e5e3d86dc0e94e6 (patch) | |
tree | 894ce452a761e1071031e25c07f311468b6c9ad3 | |
parent | b27758bc02c7111d32c1e0d36d7cbdb4ce5d0400 (diff) | |
download | ffmpeg-e9a32230c3e05deff257cbfa1e5e3d86dc0e94e6.tar.gz |
oggenc: check for failed av_mallocz()
Originally committed as revision 19245 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/oggenc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index bbbee0a906..efd57e4060 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -95,6 +95,8 @@ static int ogg_build_flac_headers(AVCodecContext *avctx, oggstream->header_len[0] = 51; oggstream->header[0] = av_mallocz(51); // per ogg flac specs p = oggstream->header[0]; + if (!p) + return AVERROR_NOMEM; bytestream_put_byte(&p, 0x7F); bytestream_put_buffer(&p, "FLAC", 4); bytestream_put_byte(&p, 1); // major version @@ -107,6 +109,8 @@ static int ogg_build_flac_headers(AVCodecContext *avctx, oggstream->header_len[1] = 1+3+4+strlen(vendor)+4; oggstream->header[1] = av_mallocz(oggstream->header_len[1]); p = oggstream->header[1]; + if (!p) + return AVERROR_NOMEM; bytestream_put_byte(&p, 0x84); // last metadata block and vorbis comment bytestream_put_be24(&p, oggstream->header_len[1] - 4); bytestream_put_le32(&p, strlen(vendor)); |