repackBSPMain(): don't check for NULL before free()

reset counts (isn't required at the moment, just for potential safety)
This commit is contained in:
Garux 2020-01-20 19:33:02 +03:00
parent dfae69d446
commit d58454d718

View File

@ -1035,12 +1035,12 @@ int repackBSPMain( int argc, char **argv ){
//numBSPDrawVerts = 0; //numBSPDrawVerts = 0;
Sys_Printf( "freed BSPDrawVerts\n" ); Sys_Printf( "freed BSPDrawVerts\n" );
} }
*/ if ( bspDrawSurfaces != 0 ) { if ( bspDrawSurfaces != 0 ) {
free( bspDrawSurfaces ); Sys_Printf( "freed bspDrawSurfaces\n" );
bspDrawSurfaces = NULL;
//numBSPDrawSurfaces = 0;
//Sys_Printf( "freed bspDrawSurfaces\n" );
} }
*/ free( bspDrawSurfaces );
bspDrawSurfaces = NULL;
numBSPDrawSurfaces = 0;
/* if ( bspLightBytes != 0 ) { /* if ( bspLightBytes != 0 ) {
free( bspLightBytes ); free( bspLightBytes );
bspLightBytes = NULL; bspLightBytes = NULL;
@ -1068,11 +1068,10 @@ int repackBSPMain( int argc, char **argv ){
//allocatedBSPBrushes = 0; //allocatedBSPBrushes = 0;
} }
*/ if ( entities != 0 ) { */ if ( entities != 0 ) {
epair_t *ep2free;
for ( i = 0; i < numBSPEntities && i < numEntities; ++i ){ for ( i = 0; i < numBSPEntities && i < numEntities; ++i ){
ep = entities[i].epairs; ep = entities[i].epairs;
while( ep != NULL){ while( ep != NULL){
ep2free = ep; epair_t *ep2free = ep;
ep = ep->next; ep = ep->next;
free( ep2free ); free( ep2free );
} }
@ -1091,20 +1090,20 @@ int repackBSPMain( int argc, char **argv ){
//numBSPModels = 0; //numBSPModels = 0;
//allocatedBSPModels = 0; //allocatedBSPModels = 0;
} }
*/ if ( bspShaders != 0 ) { if ( bspShaders != 0 ) {
free( bspShaders ); Sys_Printf( "freed bspShaders\n" );
bspShaders = NULL;
//Sys_Printf( "freed bspShaders\n" );
//numBSPShaders = 0;
//allocatedBSPShaders = 0;
} }
if ( bspEntData != 0 ) { */ free( bspShaders );
free( bspEntData ); bspShaders = NULL;
bspEntData = NULL; numBSPShaders = 0;
//Sys_Printf( "freed bspEntData\n" ); allocatedBSPShaders = 0;
//bspEntDataSize = 0; /* if ( bspEntData != 0 ) {
//allocatedBSPEntData = 0; Sys_Printf( "freed bspEntData\n" );
} }
*/ free( bspEntData );
bspEntData = NULL;
bspEntDataSize = 0;
allocatedBSPEntData = 0;
/* if ( bspNodes != 0 ) { /* if ( bspNodes != 0 ) {
free( bspNodes ); free( bspNodes );
bspNodes = NULL; bspNodes = NULL;