Skip to content

Commit

Permalink
Fix possible memory leak when format doesn't support encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Aug 4, 2023
1 parent 2624ce3 commit bc9d115
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions magick/blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,8 @@ MagickExport unsigned char *ImageToBlob(const ImageInfo *image_info,
blob=(unsigned char *) ResizeQuantumMemory(blob,*length+1,
sizeof(unsigned char));
}
else if (status == MagickFalse)
blob_info->blob=RelinquishMagickMemory(blob_info->blob);
}
}
else
Expand Down Expand Up @@ -2040,6 +2042,8 @@ MagickExport unsigned char *ImagesToBlob(const ImageInfo *image_info,
blob=(unsigned char *) ResizeQuantumMemory(blob,*length+1,
sizeof(unsigned char));
}
else if (status == MagickFalse)
blob_info->blob=RelinquishMagickMemory(blob_info->blob);
}
}
else
Expand Down

0 comments on commit bc9d115

Please sign in to comment.