Skip to content

Commit

Permalink
possible memory leak @ ImageMagick/ImageMagick#5121
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed May 5, 2022
1 parent 65ed243 commit ca7744c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions coders/pnm.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
/*
Read PNM image.
*/
comment_info.comment=(char *) NULL;
quantum_info=(QuantumInfo *) NULL;
count=ReadBlob(image,1,(unsigned char *) &format);
do
Expand Down Expand Up @@ -1391,6 +1392,10 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
}
} while ((count == 1) && (format == 'P'));
(void) CloseBlob(image);
if (comment_info.comment != (char *) NULL)
comment_info.comment=DestroyString(comment_info.comment);
if (quantum_info != (QuantumInfo *) NULL)
quantum_info=DestroyQuantumInfo(quantum_info);
if (status == MagickFalse)
return(DestroyImageList(image));
return(GetFirstImageInList(image));
Expand Down

0 comments on commit ca7744c

Please sign in to comment.