From: Dirk Lemstra Date: Tue, 30 Jan 2018 06:16:47 +0000 (+0100) Subject: Fixed memory leak reported in #964 X-Git-Tag: 7.0.7-23~212 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1fbed78912c830ccd82eecdb8a1db4882abb8276;p=imagemagick Fixed memory leak reported in #964 --- diff --git a/coders/dcm.c b/coders/dcm.c index 5f9cb02c7..2e339fc9b 100644 --- a/coders/dcm.c +++ b/coders/dcm.c @@ -3580,6 +3580,8 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception) break; colors=(size_t) (length/2); datum=(int) colors; + if (redmap != (int *) NULL) + redmap=(int *) RelinquishMagickMemory(redmap); redmap=(int *) AcquireQuantumMemory((size_t) colors, sizeof(*redmap)); if (redmap == (int *) NULL) @@ -3608,6 +3610,8 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception) break; colors=(size_t) (length/2); datum=(int) colors; + if (greenmap != (int *) NULL) + greenmap=(int *) RelinquishMagickMemory(greenmap); greenmap=(int *) AcquireQuantumMemory((size_t) colors, sizeof(*greenmap)); if (greenmap == (int *) NULL) @@ -3636,6 +3640,8 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception) break; colors=(size_t) (length/2); datum=(int) colors; + if (bluemap != (int *) NULL) + bluemap=(int *) RelinquishMagickMemory(bluemap); bluemap=(int *) AcquireQuantumMemory((size_t) colors, sizeof(*bluemap)); if (bluemap == (int *) NULL)