ecmwf / fckit

A Fortran toolkit for interoperating Fortran with C/C++
https://confluence.ecmwf.int/display/fckit
Apache License 2.0
29 stars 15 forks source link

Fix char sizes #12

Closed benjaminmenetrier closed 4 years ago

benjaminmenetrier commented 4 years ago

Hi @wdeconinck. We had some annoying random tests failure because of memory issues at JCSDA, and it seems that the reason is a simple allocation size in fckit_configuration.cc.

I don't know why, but the char arrays need to be allocated with n+1 elements instead of n in Fortran. It was done at line 367 for c_fckit_configuration_json:

    json            = new char[size + 1];

but not yet at lines 278 and 345 for c_fckit_configuration_get_string and c_fckit_configuration_get_array_string.

If you think this bugfix makes sense, we would appreciate a quick merge since we would like to synchronize our develop branch with yours as soon as possible. Thanks!

codecov-commenter commented 4 years ago

Codecov Report

Merging #12 into develop will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop      #12   +/-   ##
========================================
  Coverage    61.81%   61.81%           
========================================
  Files           48       48           
  Lines         4098     4098           
========================================
  Hits          2533     2533           
  Misses        1565     1565           
Impacted Files Coverage Δ
src/fckit/module/fckit_configuration.cc 42.54% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6b4d5c4...f47788e. Read the comment docs.