Open
Description
When I compile the RTI (using gcc 14), then I get the following error:
/home/cmenard/projects/lf/lingua-franca/core/src/main/resources/lib/c/reactor-c/trace/impl/src/trace_impl.c: In function ‘start_trace’:
/home/cmenard/projects/lf/lingua-franca/core/src/main/resources/lib/c/reactor-c/trace/impl/src/trace_impl.c:155:57: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
155 | trace->_lf_trace_buffer_size = (size_t*)calloc(sizeof(size_t), trace->_lf_number_of_trace_buffers + 1);
| ^~~~~~
/home/cmenard/projects/lf/lingua-franca/core/src/main/resources/lib/c/reactor-c/trace/impl/src/trace_impl.c:155:57: note: earlier argument should specify number of elements, later size of each element
This hints at a bug in
reactor-c/trace/impl/src/trace_impl.c
Line 155 in 587a8f9
calloc
.
I wanted to push a simple fix, but then I realized that there are more strange artifacts around this code. In particular:
- Why is the array size to be allocated incremented by 1?
- Why is
trace->_lf_trace_buffer_size
(the pointer to the newly allocated array) incremented by one inreactor-c/trace/impl/src/trace_impl.c
Line 156 in 587a8f9
- I could not find a call to
free
for this array.