Fix: callstack context memory corruption
commit
ceabb767180e "tracepoint: Refactor representation of nested types"
introduces two context fields for callstack contexts. Keeping a pointer
to the first field is not valid when adding the second context field to
the array, because the array is reallocated.
Fix this by introducing new context APIs which operate on indexes rather
than pointers:
- lttng_append_context_index,
- lttng_get_context_field_from_index,
- lttng_remove_context_field_index.
Add a NULL check to lttng_find_context so it can be used before adding
the first context.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>