From 5d17d4cc2a4aec4eda5df46ad2ceff01d070d4cd Mon Sep 17 00:00:00 2001 From: bonniegong Date: Sun, 5 Dec 2021 14:13:07 +0000 Subject: rast2tiff: Fix resource leak on error path --- archive/tools/ras2tiff.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/archive/tools/ras2tiff.c b/archive/tools/ras2tiff.c index 30104f06..d3ae889d 100644 --- a/archive/tools/ras2tiff.c +++ b/archive/tools/ras2tiff.c @@ -163,11 +163,15 @@ main(int argc, char* argv[]) buf = (unsigned char *)_TIFFmalloc(h.ras_maplength); if (buf == NULL) { fprintf(stderr, "No space to read in colormap.\n"); + fclose(in); + (void) TIFFClose(out); return (-5); } if (fread(buf, h.ras_maplength, 1, in) != 1) { fprintf(stderr, "%s: Read error on colormap.\n", argv[optind]); + fclose(in); + (void) TIFFClose(out); return (-6); } mapsize = 1<