stardis

Perform coupled heat transfer calculations
git clone git://git.meso-star.fr/stardis.git
Log | Files | Refs | README | LICENSE

commit ec0707866efe4ee702f66e6b792bb9cbeb4778f2
parent 7d78dea4ab64eb627ab2a5dd1076ac47b50f3ad7
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Wed, 14 Sep 2022 17:39:03 +0200

Fix possible invalid call to wordfree when wordexp is not called

Diffstat:
Msrc/stardis-parsing.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/stardis-parsing.c b/src/stardis-parsing.c @@ -2011,6 +2011,7 @@ read_model FILE* f = NULL; struct txtrdr* txtrdr = NULL; wordexp_t pwordexp; + int word_initialized = 0; ASSERT(model_files && stardis); files = darray_str_cdata_get(model_files); @@ -2032,6 +2033,7 @@ read_model ERR(txtrdr_read_line(txtrdr)); line = txtrdr_get_line(txtrdr); if(!line) break; + word_initialized = 1; switch(wordexp(line, &pwordexp, flags)) { case 0: /* No error */ break; @@ -2086,7 +2088,7 @@ exp_error: ASSERT(!f && !txtrdr); exit: - wordfree(&pwordexp); + if(word_initialized) wordfree(&pwordexp); return res; error: if(f) fclose(f);