From 7a48aff7ee38b996d1f9d4b9786d4a2eb8391865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hubert=20Figui=C3=A8re?= Date: Fri, 7 Apr 2023 21:51:46 -0400 Subject: [PATCH] Issue #6735 - Remove memory leak when processing Fuji RAF converted to DNG --- rtexif/rtexif.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index a7125fb9a..4848299ad 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -1209,6 +1209,10 @@ Tag::Tag (TagDirectory* p, FILE* f, int base) goto defsubdirs; } } else { + // In some circumstances, `value` may have been allocated, so + // delete it to prevent a leak. See issue + // https://github.com/Beep6581/RawTherapee/issues/6735 + delete [] value; // read value value = new unsigned char [valuesize + 1]; auto readSize = fread (value, 1, valuesize, f);