Mercurial > libavcodec.hg
comparison motionpixels.c @ 9415:141badec76fc libavcodec
Add a av_fast_malloc function and replace several uses of av_fast_realloc,
thus avoiding potential memleaks and pointless memcpys.
author | reimar |
---|---|
date | Sun, 12 Apr 2009 13:17:37 +0000 |
parents | 54bc8a2727b0 |
children | 0dce4fe6e6f3 |
comparison
equal
deleted
inserted
replaced
9414:5a738e8f9524 | 9415:141badec76fc |
---|---|
295 av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); | 295 av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); |
296 return -1; | 296 return -1; |
297 } | 297 } |
298 | 298 |
299 /* le32 bitstream msb first */ | 299 /* le32 bitstream msb first */ |
300 mp->bswapbuf = av_fast_realloc(mp->bswapbuf, &mp->bswapbuf_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); | 300 av_fast_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); |
301 if (!mp->bswapbuf) | |
302 AVERROR(ENOMEM); | |
301 mp->dsp.bswap_buf((uint32_t *)mp->bswapbuf, (const uint32_t *)buf, buf_size / 4); | 303 mp->dsp.bswap_buf((uint32_t *)mp->bswapbuf, (const uint32_t *)buf, buf_size / 4); |
302 if (buf_size & 3) | 304 if (buf_size & 3) |
303 memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3); | 305 memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3); |
304 init_get_bits(&gb, mp->bswapbuf, buf_size * 8); | 306 init_get_bits(&gb, mp->bswapbuf, buf_size * 8); |
305 | 307 |