summaryrefslogtreecommitdiff
path: root/libavcodec/nuv.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2011-01-24 19:35:20 +0100
committerJanne Grunau <janne-ffmpeg@jannau.net>2011-01-24 21:25:43 +0100
commit4be170c9371dfd3ae07a348b449002fc1d2b70e4 (patch)
tree9eab366555c6353c25750cd6e37e296e0d9414cc /libavcodec/nuv.c
parent032f4068646d6d29f4657eeb69425ec349dcaa7c (diff)
downloadffmpeg-4be170c9371dfd3ae07a348b449002fc1d2b70e4.tar.gz
Use av_fast_malloc instead of av_realloc.
This should be faster, is less code and fixes issue 2524 (allocation error would lead to crash). (cherry picked from commit e7b95918fca1c3d057d35f77ba58ee2d00d03151)
Diffstat (limited to 'libavcodec/nuv.c')
-rw-r--r--libavcodec/nuv.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index 26dcfd0d22..d65799ee1e 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -116,8 +116,7 @@ static int codec_reinit(AVCodecContext *avctx, int width, int height, int qualit
return 0;
avctx->width = c->width = width;
avctx->height = c->height = height;
- c->decomp_size = c->height * c->width * 3 / 2;
- c->decomp_buf = av_realloc(c->decomp_buf, c->decomp_size + AV_LZO_OUTPUT_PADDING);
+ av_fast_malloc(&c->decomp_buf, &c->decomp_size, c->height * c->width * 3 / 2);
if (!c->decomp_buf) {
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
return 0;