Mercurial > libavcodec.hg
comparison a64multienc.c @ 12446:10b5a51810f9 libavcodec
Checking return values of av_malloc(z) and report an error in case.
author | bindhammer |
---|---|
date | Tue, 31 Aug 2010 07:14:47 +0000 |
parents | 305987348a98 |
children |
comparison
equal
deleted
inserted
replaced
12445:7919771169c5 | 12446:10b5a51810f9 |
---|---|
190 a64_palette[mc_colors[a]][2] * 0.11; | 190 a64_palette[mc_colors[a]][2] * 0.11; |
191 } | 191 } |
192 | 192 |
193 c->mc_frame_counter = 0; | 193 c->mc_frame_counter = 0; |
194 c->mc_use_5col = avctx->codec->id == CODEC_ID_A64_MULTI5; | 194 c->mc_use_5col = avctx->codec->id == CODEC_ID_A64_MULTI5; |
195 c->mc_meta_charset = av_malloc (32000 * c->mc_lifetime * sizeof(int)); | 195 |
196 c->mc_best_cb = av_malloc (CHARSET_CHARS * 32 * sizeof(int)); | 196 if(!(c->mc_meta_charset = av_malloc (32000 * c->mc_lifetime * sizeof(int))) || |
197 c->mc_charmap = av_mallocz(1000 * c->mc_lifetime * sizeof(int)); | 197 !(c->mc_best_cb = av_malloc (CHARSET_CHARS * 32 * sizeof(int))) || |
198 c->mc_colram = av_mallocz(CHARSET_CHARS * sizeof(uint8_t)); | 198 !(c->mc_charmap = av_mallocz(1000 * c->mc_lifetime * sizeof(int))) || |
199 c->mc_charset = av_malloc (0x800 * (INTERLACED+1) * sizeof(uint8_t)); | 199 !(c->mc_colram = av_mallocz(CHARSET_CHARS * sizeof(uint8_t))) || |
200 !(c->mc_charset = av_malloc (0x800 * (INTERLACED+1) * sizeof(uint8_t)))) { | |
201 av_log(avctx, AV_LOG_ERROR, "Failed to allocate buffer memory.\n"); | |
202 return AVERROR(ENOMEM); | |
203 } | |
200 | 204 |
201 /* set up extradata */ | 205 /* set up extradata */ |
202 avctx->extradata = av_mallocz(8 * 4 + FF_INPUT_BUFFER_PADDING_SIZE); | 206 if(!(avctx->extradata = av_mallocz(8 * 4 + FF_INPUT_BUFFER_PADDING_SIZE))) { |
207 av_log(avctx, AV_LOG_ERROR, "Failed to allocate memory for extradata.\n"); | |
208 return AVERROR(ENOMEM); | |
209 } | |
203 avctx->extradata_size = 8 * 4; | 210 avctx->extradata_size = 8 * 4; |
204 AV_WB32(avctx->extradata, c->mc_lifetime); | 211 AV_WB32(avctx->extradata, c->mc_lifetime); |
205 AV_WB32(avctx->extradata+16, INTERLACED); | 212 AV_WB32(avctx->extradata+16, INTERLACED); |
206 | 213 |
207 avcodec_get_frame_defaults(&c->picture); | 214 avcodec_get_frame_defaults(&c->picture); |