Mercurial > libavformat.hg
changeset 5053:037f1082ecd6 libavformat
oggenc: check for failed av_mallocz()
author | jbr |
---|---|
date | Sun, 21 Jun 2009 20:13:54 +0000 |
parents | 4d9e9f6407df |
children | 6c7d0a04ae96 |
files | oggenc.c |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/oggenc.c Sat Jun 20 14:51:03 2009 +0000 +++ b/oggenc.c Sun Jun 21 20:13:54 2009 +0000 @@ -95,6 +95,8 @@ 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 @@ 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));