aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-12-26 16:38:55 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-12-26 16:38:55 +0000
commit6fe68c7b97213d8f06853c95ff7e6c6d77817e40 (patch)
tree22a6e57f2559cbeb22675ead40c99a4700ccd1e3 /libavcodec
parent621e6525a6d9e3217c8c9ebde82acb2b551a73c7 (diff)
downloadffmpeg-6fe68c7b97213d8f06853c95ff7e6c6d77817e40.tar.gz
Factorize "avctx->width + 2" out to avoid someone mistakenly changing
some but not all. Originally committed as revision 16336 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/faxcompr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c
index 10a0730417..c01a1ef752 100644
--- a/libavcodec/faxcompr.c
+++ b/libavcodec/faxcompr.c
@@ -280,15 +280,16 @@ int ff_ccitt_unpack(AVCodecContext *avctx,
GetBitContext gb;
int *runs, *ref, *runend;
int ret;
+ int runsize= avctx->width + 2;
- runs = av_malloc((avctx->width + 2) * sizeof(runs[0]));
- ref = av_malloc((avctx->width + 2) * sizeof(ref[0]));
+ runs = av_malloc(runsize * sizeof(runs[0]));
+ ref = av_malloc(runsize * sizeof(ref[0]));
ref[0] = avctx->width;
ref[1] = 0;
ref[2] = 0;
init_get_bits(&gb, src, srcsize*8);
for(j = 0; j < height; j++){
- runend = runs + avctx->width + 2;
+ runend = runs + runsize;
if(compr == TIFF_G4){
ret = decode_group3_2d_line(avctx, &gb, avctx->width, runs, runend, ref);
if(ret < 0){