Fix HMP deallocation
All checks were successful
JCS-Prod/RSE-Terrain/pipeline/head This commit looks good
All checks were successful
JCS-Prod/RSE-Terrain/pipeline/head This commit looks good
This commit is contained in:
parent
94ac7205c8
commit
ebfd3faeaa
@ -85,6 +85,7 @@ static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS
|
||||
if (RSPTerrain_processHMPFile(hmpStruct, args_value[file_index], libParams) != RSPLIB_SUCCESS) {
|
||||
printf("[ERR] Failed to parse datas from %s\n", args_value[file_index]);
|
||||
RSPTerrain_freeHMP(hmpStruct);
|
||||
free(hmpStruct);
|
||||
return RSPLIB_ERROR_PROCESS;
|
||||
}
|
||||
} else return RSPLIB_ERROR_MEMORY;
|
||||
@ -107,6 +108,7 @@ static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS
|
||||
RSPTerrain_freeHeightmap(terrainHM);
|
||||
} else {
|
||||
RSPTerrain_freeHMP(hmpStruct);
|
||||
free(hmpStruct);
|
||||
return RSPLIB_ERROR_MEMORY;
|
||||
}
|
||||
|
||||
@ -126,11 +128,13 @@ static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS
|
||||
RSPTerrain_freeMesh(terrainMesh);
|
||||
} else {
|
||||
RSPTerrain_freeHMP(hmpStruct);
|
||||
free(hmpStruct);
|
||||
return RSPLIB_ERROR_MEMORY;
|
||||
}
|
||||
//#endif
|
||||
|
||||
RSPTerrain_freeHMP(hmpStruct);
|
||||
free(hmpStruct);
|
||||
}
|
||||
|
||||
return RSPLIB_SUCCESS;
|
||||
|
@ -74,8 +74,6 @@ void RSPTerrain_freeHMP(T_RSPTERRAIN_HMP* hmpStruct) {
|
||||
if (hmpStruct == NULL) return;
|
||||
|
||||
if (hmpStruct->tilesmap) free(hmpStruct->tilesmap);
|
||||
|
||||
free(hmpStruct);
|
||||
}
|
||||
|
||||
void RSPTerrain_freeHeightmap(T_RSPTERRAIN_HEIGHTMAP* heightmap) {
|
||||
@ -85,14 +83,10 @@ void RSPTerrain_freeHeightmap(T_RSPTERRAIN_HEIGHTMAP* heightmap) {
|
||||
|
||||
for ( i = 0; i < heightmap->width * RSPTERRAINLIB_TILE_SAMPLING; i++ )
|
||||
if (heightmap->heightmap[i]) free(heightmap->heightmap[i]);
|
||||
|
||||
free(heightmap);
|
||||
}
|
||||
|
||||
void RSPTerrain_freeMesh(T_RSPTERRAIN_MESH* mesh) {
|
||||
if (mesh == NULL) return;
|
||||
|
||||
if (mesh->verticesmap) free(mesh->verticesmap);
|
||||
|
||||
free(mesh);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user