# HG changeset patch # User michael # Date 1230309535 0 # Node ID 2f7c09bb6bfb71853c72936e92b70578710b7ca7 # Parent 5f85d21a70b2e2cef47b4ddb81065c460b1219d1 Factorize "avctx->width + 2" out to avoid someone mistakenly changing some but not all. diff -r 5f85d21a70b2 -r 2f7c09bb6bfb faxcompr.c --- a/faxcompr.c Fri Dec 26 16:30:50 2008 +0000 +++ b/faxcompr.c Fri Dec 26 16:38:55 2008 +0000 @@ -280,15 +280,16 @@ 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){