Dont leak memory when calling load surfaces multiple times

This commit is contained in:
jaburns
2021-07-19 17:49:14 -06:00
parent ab71363d75
commit 04cabfe13b
5 changed files with 11 additions and 5 deletions
+3 -3
View File
@@ -122,9 +122,9 @@ SM64_LIB_FN void sm64_static_surfaces_load( const struct SM64Surface *surfaceArr
surfaces_load_static( surfaceArray, numSurfaces );
}
SM64_LIB_FN uint32_t sm64_mario_create( int16_t x, int16_t y, int16_t z )
SM64_LIB_FN int32_t sm64_mario_create( int16_t x, int16_t y, int16_t z )
{
uint32_t marioIndex = obj_pool_alloc_index( &s_mario_instance_pool, sizeof( struct MarioInstance ));
int32_t marioIndex = obj_pool_alloc_index( &s_mario_instance_pool, sizeof( struct MarioInstance ));
struct MarioInstance *newInstance = s_mario_instance_pool.objects[marioIndex];
newInstance->globalState = global_state_create();
@@ -241,4 +241,4 @@ SM64_LIB_FN void sm64_surface_object_delete( uint32_t objectId )
}
surfaces_unload_object( objectId );
}
}