commit 37063248b849cd84003f899b77875385c981830b
parent 6f72b7547c3af133da8b6635c88025bf0ecce138
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 24 Jun 2020 18:43:38 +0200
Fix a possible memory leak in solve_probe_boubdary_Xd
Diffstat:
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/sdis_solve_probe_boundary_Xd.h b/src/sdis_solve_probe_boundary_Xd.h
@@ -195,7 +195,10 @@ XD(solve_probe_boundary)
* function. Simply takes 0 as relative time */
time = 0;
res_local = green_function_create_path(greens[ithread], &green_path);
- if(res_local != RES_OK) { ATOMIC_SET(&res, res_local); continue; }
+ if(res_local != RES_OK) {
+ ATOMIC_SET(&res, res_local);
+ goto realisation_error;
+ }
pgreen_path = &green_path;
}
@@ -205,7 +208,7 @@ XD(solve_probe_boundary)
/* Handle fatal error */
if(res_simul != RES_OK && res_simul != RES_BAD_OP) {
ATOMIC_SET(&res, res_simul);
- continue;
+ goto realisation_error;
}
if(pheat_path) {
@@ -216,9 +219,15 @@ XD(solve_probe_boundary)
/* Check if the path must be saved regarding the register_paths mask */
if(!(register_paths & (int)pheat_path->status)) {
heat_path_release(pheat_path);
- } else { /* Register the sampled path */
+ pheat_path = NULL;
+ } else {
+ /* Register the sampled path */
res_local = estimator_add_and_release_heat_path(estimator, pheat_path);
- if(res_local != RES_OK) { ATOMIC_SET(&res, res_local); continue; }
+ if(res_local != RES_OK) {
+ ATOMIC_SET(&res, res_local);
+ goto realisation_error;
+ }
+ pheat_path = NULL;
}
}
@@ -240,6 +249,12 @@ XD(solve_probe_boundary)
progress = pcent;
log_info(scn->dev, "Solving probe boundary temperature: %3d%%\r", progress);
}
+
+ realisation_exit:
+ if(pheat_path) heat_path_release(pheat_path);
+ continue;
+ realisation_error:
+ goto realisation_exit;
}
if(res != RES_OK) goto error;