code-saturne / code_saturne

code_saturne public mirror
https://www.code-saturne.org
GNU General Public License v2.0
218 stars 81 forks source link

Type mismatch in allocation for cs_mesh_extrude_face_info_t #67

Closed ghost closed 3 years ago

ghost commented 3 years ago

https://github.com/code-saturne/code_saturne/blob/a83128d0d5bb03bfd40d65e32215150e6f520529/src/mesh/cs_mesh_extrude.c#L2239

cs_mesh_extrude_face_info_create allocates cs_mesh_extrude_face_info_t.expansion_factor as an array of float_t while it should be an array of float, see https://github.com/code-saturne/code_saturne/blob/a83128d0d5bb03bfd40d65e32215150e6f520529/src/mesh/cs_mesh_extrude.h#L63 Even though float_t is typede'f to float on many architectures, it could also be double or long double. In that case, the allocation would waste memory.

Note that I found this during unrelated code inspection. I did not observe any real-world impact.

YvanFournier commented 3 years ago

Thanks for reporting this.

I was not even aware float_t was defined on many architectures at all. This was a typo...

Fixed in master branch.