From 4f6da09f67b472a64f684ed8125cc0e316a395b1 Mon Sep 17 00:00:00 2001 From: liningjie Date: Mon, 14 Aug 2023 23:17:28 +0800 Subject: [PATCH] Consider error return of writeSelections(). Fixes #553 --- tools/tiffcrop.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c index 39156b5..cb8139b 100644 --- a/tools/tiffcrop.c +++ b/tools/tiffcrop.c @@ -2464,8 +2464,14 @@ main(int argc, char* argv[]) { /* Whole image or sections not based on output page size */ if (crop.selections > 0) { - writeSelections(in, &out, &crop, &image, &dump, seg_buffs, - mp, argv[argc - 1], &next_page, total_pages); + if (writeSelections(in, &out, &crop, &image, &dump, + seg_buffs, mp, argv[argc - 1], + &next_page, total_pages)) + { + TIFFError("main", + "Unable to write new image selections"); + exit(EXIT_FAILURE); + } } else /* One file all images and sections */ { @@ -7920,7 +7926,7 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop, /* Memory is freed before crop_buff_ptr is overwritten */ if (*crop_buff_ptr != NULL) { - _TIFFfree(*crop_buff_ptr); + _TIFFfree(*crop_buff_ptr); } /* process full image, no crop buffer needed */ -- 2.33.0