--- ray/src/rt/rv2.c 1991/08/26 10:12:02 1.26 +++ ray/src/rt/rv2.c 1991/10/10 12:08:58 1.28 @@ -542,6 +542,7 @@ char *s; writepict(s) /* write the picture to a file */ char *s; { + extern char VersionID[]; static char buf[128]; char *fname; FILE *fp; @@ -565,6 +566,7 @@ char *s; fputs(progname, fp); fprintview(&ourview, fp); putc('\n', fp); + fprintf(fp, "SOFTWARE= %s\n", VersionID); if (exposure != 1.0) fputexpos(exposure, fp); if (dev->pixaspect != 1.0) @@ -574,14 +576,18 @@ char *s; fputresolu(YMAJOR|YDECR, hresolu, vresolu, fp); scanline = (COLR *)malloc(hresolu*sizeof(COLR)); - if (scanline == NULL) - error(SYSTEM, "out of memory in writepict"); + if (scanline == NULL) { + error(COMMAND, "not enough memory!"); + fclose(fp); + unlink(fname); + return; + } for (y = vresolu-1; y >= 0; y--) { getpictcolrs(y, scanline, &ptrunk, hresolu, vresolu); if (fwritecolrs(scanline, hresolu, fp) < 0) break; } + free((char *)scanline); if (fclose(fp) < 0) error(COMMAND, "write error"); - free((char *)scanline); }