star-mesh

Define and load a binary data format for meshes
git clone git://git.meso-star.fr/star-mesh.git
Log | Files | Refs | README | LICENSE

commit 45a7de87a0de2e5811c10dd4280de24d0dfb5a26
parent d17fe2278779cc5799cbc22968a90edcc91135d9
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu, 24 Mar 2022 15:47:33 +0100

Fix a possible issue on data unmap

Diffstat:
Msrc/smsh.c | 6++++--
Msrc/smsh.h | 2+-
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/smsh.c b/src/smsh.c @@ -44,8 +44,10 @@ reset_smsh(struct smsh* smsh) smsh->nnodes = 0; smsh->ncells = 0; smsh->pagesize = 0; - if(smsh->nodes) munmap(smsh->nodes, smsh->map_len_nodes); - if(smsh->cells) munmap(smsh->cells, smsh->map_len_cells); + if(smsh->nodes && smsh->nodes != MAP_FAILED) + munmap(smsh->nodes, smsh->map_len_nodes); + if(smsh->cells && smsm->cells != MAP_FAILED) + munmap(smsh->cells, smsh->map_len_cells); smsh->nodes = NULL; smsh->cells = NULL; smsh->map_len_nodes = 0; diff --git a/src/smsh.h b/src/smsh.h @@ -66,7 +66,7 @@ struct smsh; BEGIN_DECLS /******************************************************************************* - * STri API + * Star-Mesh API ******************************************************************************/ SMSH_API res_T smsh_create