diff options
author | Even Rouault <even.rouault@spatialys.com> | 2023-03-11 13:23:49 +0000 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2023-03-11 13:23:49 +0000 |
commit | 1d5b1181c980090a6518f11e61a18b0e268bf31a (patch) | |
tree | d6ba784b47d8ac380119e1b5d50e708cfd0df14c | |
parent | 6bb0f1171adfcccde2cd7931e74317cccb7db845 (diff) | |
parent | 881a070194783561fd209b7c789a4e75566f7f37 (diff) | |
download | libtiff-git-1d5b1181c980090a6518f11e61a18b0e268bf31a.tar.gz |
Merge branch 'master' into 'master'
Fix memory leak in tiffcrop.c
See merge request libtiff/libtiff!475
-rw-r--r-- | tools/tiffcrop.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c index d3e11ba2..24d0ca84 100644 --- a/tools/tiffcrop.c +++ b/tools/tiffcrop.c @@ -8782,8 +8782,13 @@ static int createCroppedImage(struct image_data *image, struct crop_mask *crop, read_buff = *read_buff_ptr; + /* Memory is freed before crop_buff_ptr is overwritten */ + if (*crop_buff_ptr != NULL) + { + _TIFFfree(*crop_buff_ptr); + } + /* process full image, no crop buffer needed */ - crop_buff = read_buff; *crop_buff_ptr = read_buff; crop->combined_width = image->width; crop->combined_length = image->length; |