commit 158aa7fb0d04dd996f71308c924b9fa1e39a1624
parent f3e335404127e340b76ff7d6d8e24c9ee5e77dd9
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 14 Jan 2021 18:18:46 +0100
Fix memory leaks
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/atrstm.c b/src/atrstm.c
@@ -60,6 +60,7 @@ release_atrstm(ref_T* ref)
if(atrstm->atrtp) ATRTP(ref_put(atrstm->atrtp));
if(atrstm->atrri) ATRRI(ref_put(atrstm->atrri));
if(atrstm->suvm) SUVM(device_ref_put(atrstm->suvm));
+ if(atrstm->volume) SUVM(volume_ref_put(atrstm->volume));
if(atrstm->svx) SVX(device_ref_put(atrstm->svx));
if(atrstm->logger == &atrstm->logger__) logger_release(&atrstm->logger__);
str_release(&atrstm->name);
@@ -112,6 +113,7 @@ atrstm_create
atrstm->spectral_type = args->spectral_type;
atrstm->wlen_range[0] = args->wlen_range[0];
atrstm->wlen_range[1] = args->wlen_range[1];
+ str_init(allocator, &atrstm->name);
if(logger) {
atrstm->logger = logger;
diff --git a/src/atrstm_setup_uvm.c b/src/atrstm_setup_uvm.c
@@ -71,6 +71,8 @@ setup_unstructured_volumetric_mesh
log_info(atrstm, "Loading and structuring the volumetric mesh '%s'\n",
sth_filename);
+ time_current(&t0);
+
/* Load the volumetric mesh */
res = sth_create(atrstm->logger, atrstm->allocator, atrstm->verbose, &sth);
if(res != RES_OK) goto error;
@@ -97,7 +99,7 @@ setup_unstructured_volumetric_mesh
log_info(atrstm, "Setup volumetric mesh in %s\n", buf);
exit:
- *out_volume = NULL;
+ *out_volume = volume;
if(sth) STH(ref_put(sth));
return res;
error: