443 |
|
} |
444 |
|
barsize = 2*yrad + 1; |
445 |
|
scanin = (COLOR **)malloc(barsize*sizeof(COLOR *)); |
446 |
+ |
if (scanin == NULL) |
447 |
+ |
goto memerr; |
448 |
|
for (i = 0; i < barsize; i++) { |
449 |
|
scanin[i] = (COLOR *)malloc(xres*sizeof(COLOR)); |
450 |
< |
if (scanin[i] == NULL) { |
451 |
< |
fprintf(stderr, "%s: out of memory\n", progname); |
450 |
< |
quit(1); |
451 |
< |
} |
450 |
> |
if (scanin[i] == NULL) |
451 |
> |
goto memerr; |
452 |
|
} |
453 |
|
if (obarsize > 0) { |
454 |
|
scoutbar = (COLOR **)malloc(obarsize*sizeof(COLOR *)); |
455 |
|
greybar = (float **)malloc(obarsize*sizeof(float *)); |
456 |
+ |
if (scoutbar == NULL | greybar == NULL) |
457 |
+ |
goto memerr; |
458 |
|
for (i = 0; i < obarsize; i++) { |
459 |
|
scoutbar[i] = (COLOR *)malloc(ncols*sizeof(COLOR)); |
460 |
|
greybar[i] = (float *)malloc(ncols*sizeof(float)); |
461 |
< |
if (scoutbar[i] == NULL | greybar[i] == NULL) { |
462 |
< |
fprintf(stderr, "%s: out of memory\n", |
461 |
< |
progname); |
462 |
< |
quit(1); |
463 |
< |
} |
461 |
> |
if (scoutbar[i] == NULL | greybar[i] == NULL) |
462 |
> |
goto memerr; |
463 |
|
} |
464 |
|
} else { |
465 |
|
scanout = (COLOR *)malloc(ncols*sizeof(COLOR)); |
466 |
< |
if (scanout == NULL) { |
467 |
< |
fprintf(stderr, "%s: out of memory\n", progname); |
469 |
< |
quit(1); |
470 |
< |
} |
466 |
> |
if (scanout == NULL) |
467 |
> |
goto memerr; |
468 |
|
} |
469 |
|
/* record pixel aspect ratio */ |
470 |
|
if (!correctaspect) { |
485 |
|
printf("\n"); |
486 |
|
/* write out resolution */ |
487 |
|
fputresolu(order, ncols, nrows, stdout); |
488 |
+ |
return; |
489 |
+ |
memerr: |
490 |
+ |
fprintf(stderr, "%s: out of memory\n", progname); |
491 |
+ |
quit(1); |
492 |
|
} |
493 |
|
|
494 |
|
|