commit d11c303f3fb9be54302cc091634970f1d0c68b51
parent 1415567ce312561512a420b8962f0b76276b011c
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 5 Oct 2018 10:03:20 +0200
Fix a possible "double free" of enclosures
Diffstat:
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/sdis_scene_Xd.h b/src/sdis_scene_Xd.h
@@ -648,13 +648,10 @@ XD(setup_enclosures)(struct sdis_scene* scn, struct sencXd(descriptor)* desc)
SENCXD(descriptor_get_enclosure(desc, ienc, &enc));
SENCXD(enclosure_get_header(enc, &header));
- /* As paths don't go in infinite enclosures
- * we can accept models are broken there.
- * But nowhere else. */
- if(header.enclosed_media_count != 1
- && !header.is_infinite) {
+ /* As paths don't go in infinite enclosures we can accept models are broken
+ * there. But nowhere else. */
+ if(header.enclosed_media_count != 1 && !header.is_infinite) {
res = RES_BAD_ARG;
- SENCXD(enclosure_ref_put(enc));
goto error;
}
diff --git a/src/sdis_solve_Xd.h b/src/sdis_solve_Xd.h
@@ -506,8 +506,8 @@ XD(fluid_temperature)
return RES_BAD_OP;
}
- /* The hc upper bound can be 0 is h is uniformly 0.
- * In that case the result is the initial condition. */
+ /* The hc upper bound can be 0 is h is uniformly 0. In that case the result
+ * is the initial condition. */
if(enc->hc_upper_bound == 0) {
/* Cannot be in the fluid without starting there. */
ASSERT(SXD_HIT_NONE(&rwalk->hit));
@@ -530,9 +530,8 @@ XD(fluid_temperature)
/* A trick to force first r test result. */
r = 1;
- /* Sample time until intial condition is reached
- * or a true convection occurs. */
- while(1) {
+ /* Sample time until init condition is reached or a true convection occurs. */
+ for(;;) {
/* Setup the fragment of the interface. */
XD(setup_interface_fragment)(&frag, &rwalk->vtx, &rwalk->hit, rwalk->hit_side);