ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/pfilt.c
(Generate patch)

Comparing ray/src/px/pfilt.c (file contents):
Revision 2.9 by greg, Fri Jun 25 15:01:17 1993 UTC vs.
Revision 2.10 by greg, Fri Jun 25 17:07:03 1993 UTC

# Line 443 | Line 443 | scan2init()                    /* prepare scanline arrays */
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) {
# Line 488 | Line 485 | scan2init()                    /* prepare scanline arrays */
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines