Fix: callstack context memory corruption
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 29 Jun 2020 23:52:08 +0000 (19:52 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 30 Jun 2020 16:53:31 +0000 (12:53 -0400)
commitc02eb85907f43fe17d97604633ae9aa1ed2afb36
treedb5a662064634f0a03d63c843035f7488135f1e3
parent0b1facd407285855c896753ac869a7e6bc764ccb
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>
include/lttng/events.h
src/lttng-context-callstack.c
src/lttng-context.c
This page took 0.03031 seconds and 4 git commands to generate.