Skip to content

Commit

Permalink
mapgdal: remove useless memory allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Mar 21, 2021
1 parent bdfd108 commit bdfb787
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions mapgdal.c
Expand Up @@ -140,7 +140,6 @@ int msSaveImageGDAL( mapObj *map, imageObj *image, const char *filenameIn )
GDALDriverH hMemDriver, hOutputDriver;
int nBands = 1;
int iLine;
GByte *pabyAlphaLine = NULL;
char **papszOptions = NULL;
outputFormatObj *format = image->format;
rasterBufferObj rb;
Expand Down Expand Up @@ -216,12 +215,6 @@ int msSaveImageGDAL( mapObj *map, imageObj *image, const char *filenameIn )
return MS_FAILURE;
}
} else if( format->imagemode == MS_IMAGEMODE_RGBA ) {
pabyAlphaLine = (GByte *) calloc(image->width,1);
if (pabyAlphaLine == NULL) {
msReleaseLock( TLOCK_GDAL );
msSetError( MS_MEMERR, "Out of memory allocating %u bytes.\n", "msSaveImageGDAL()", image->width);
return MS_FAILURE;
}
nBands = 4;
assert( MS_RENDERER_PLUGIN(format) && format->vtable->supports_pixel_buffer );
if(MS_UNLIKELY(MS_FAILURE == format->vtable->getRasterBufferHandle(image,&rb))) {
Expand Down Expand Up @@ -359,9 +352,6 @@ int msSaveImageGDAL( mapObj *map, imageObj *image, const char *filenameIn )
}
}

if( pabyAlphaLine != NULL )
free( pabyAlphaLine );

/* -------------------------------------------------------------------- */
/* Attach the palette if appropriate. */
/* -------------------------------------------------------------------- */
Expand Down

0 comments on commit bdfb787

Please sign in to comment.