diff --git a/libImaging/Storage.c b/libImaging/Storage.c index ac9c6b2de..e5f620363 100644 --- a/libImaging/Storage.c +++ b/libImaging/Storage.c @@ -50,15 +50,16 @@ ImagingNewPrologueSubtype(const char *mode, int xsize, int ysize, int size) { Imaging im; - im = (Imaging) calloc(1, size); - if (!im) - return (Imaging) ImagingError_MemoryError(); - /* linesize overflow check, roughly the current largest space req'd */ if (xsize > (INT_MAX / 4) - 1) { return (Imaging) ImagingError_MemoryError(); } + im = (Imaging) calloc(1, size); + if (!im) { + return (Imaging) ImagingError_MemoryError(); + } + /* Setup image descriptor */ im->xsize = xsize; im->ysize = ysize; @@ -228,8 +229,7 @@ Imaging ImagingNewPrologue(const char *mode, int xsize, int ysize) { return ImagingNewPrologueSubtype( - mode, xsize, ysize, sizeof(struct ImagingMemoryInstance) - ); + mode, xsize, ysize, sizeof(struct ImagingMemoryInstance)); } Imaging @@ -371,7 +371,6 @@ ImagingNewBlock(const char *mode, int xsize, int ysize) } im->destroy = ImagingDestroyBlock; - } return ImagingNewEpilogue(im);