Fix RNG memory leak on various error conditions

This memory leak shows up in the flaky blendfile_versioning test, and
this may help fix it.
This commit is contained in:
Brecht Van Lommel 2024-01-02 16:17:53 +01:00
parent 4657d541c8
commit 71474da5fd
3 changed files with 3 additions and 0 deletions

View File

@ -1565,6 +1565,7 @@ static bool cloth_build_springs(ClothModifierData *clmd, Mesh *mesh)
if (tmp_mesh) {
BKE_id_free(nullptr, &tmp_mesh->id);
}
BLI_rng_free(rng);
return false;
}
}

View File

@ -4353,6 +4353,7 @@ static void particles_fluid_step(ParticleSimulationData *sim,
BLI_snprintf(debugStrBuffer,
sizeof(debugStrBuffer),
"particles_fluid_step::error - unknown particle system type\n");
BLI_rng_free(sim->rng);
return;
}
# if 0

View File

@ -2086,6 +2086,7 @@ void rand_delaunay_test(int test_kind,
}
default:
std::cout << "unknown delaunay test type\n";
BLI_rng_free(rng);
return;
}
if (otype != CDT_FULL) {