Fix: set proper size when creating new strings
After adding a wrapper to g_array_index that validates that accessed
indices don't go past the end of the arrays, I got this:
(╯°□°)╯︵ ┻━┻ /home/smarchi/src/babeltrace/src/lib/trace-ir/field.c:392: create_string_field(): Assertion `0 < string_field->buf->len` failed.
The problem is that arrays backing string fields are created with:
string->buf = g_array_sized_new(FALSE, FALSE, sizeof(char), 1);
This g_array_sized_new call reserves space for one element, but doesn't
actually make the length of the array one. Add a call to
g_array_set_size to fix that. Fix another occurence of the same bug in
ctf-writer.
Change-Id: I2b90b26c37d70d64bcd825b5b07b204bcbb5baf5
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10904
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
This page took 0.036067 seconds and 4 git commands to generate.