Permalink
Browse files

remove NULL checks before free()

free(NULL) is legal (no-op).
  • Loading branch information...
MaxKellermann committed Mar 27, 2014
1 parent 3e2964c commit 9b4b819cf3a6b2f4923828f83477d5ffd87f540e
Showing with 6 additions and 8 deletions.
  1. +5 −7 mapshape.c
  2. +1 −1 mapxbase.c
View
@@ -418,8 +418,8 @@ void msSHPClose(SHPHandle psSHP )
free( psSHP->panRecLoaded );
if(psSHP->pabyRec) free(psSHP->pabyRec);
if(psSHP->panParts) free(psSHP->panParts);
free(psSHP->pabyRec);
free(psSHP->panParts);
fclose( psSHP->fpSHX );
fclose( psSHP->fpSHP );
@@ -1795,7 +1795,7 @@ void msShapefileClose(shapefileObj *shpfile)
if (shpfile && shpfile->isopen == MS_TRUE) { /* Silently return if called with NULL shpfile by freeLayer() */
if(shpfile->hSHP) msSHPClose(shpfile->hSHP);
if(shpfile->hDBF) msDBFClose(shpfile->hDBF);
if(shpfile->status) free(shpfile->status);
free(shpfile->status);
shpfile->isopen = MS_FALSE;
}
}
@@ -1809,10 +1809,8 @@ int msShapefileWhichShapes(shapefileObj *shpfile, rectObj rect, int debug)
char *sourcename = 0; /* shape file source string from map file */
char *s = 0; /* pointer to start of '.shp' in source string */
if(shpfile->status) {
free(shpfile->status);
shpfile->status = NULL;
}
free(shpfile->status);
shpfile->status = NULL;
shpfile->statusbounds = rect; /* save the search extent */
View
@@ -301,7 +301,7 @@ void msDBFClose(DBFHandle psDBF)
free( psDBF->pszHeader );
free( psDBF->pszCurrentRecord );
if(psDBF->pszStringField) free(psDBF->pszStringField);
free(psDBF->pszStringField);
free( psDBF );
}

0 comments on commit 9b4b819

Please sign in to comment.