Fix: fd-cache: Assertion failure if cache not allocated
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 13 Sep 2019 15:21:46 +0000 (11:21 -0400)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 16 Sep 2019 18:20:14 +0000 (14:20 -0400)
commit9f7cf1d279424a217ca573f854b6da5cb464df32
tree6dc65bc076f6635a0218d71c0693905965be84ed
parent4830a4bc78e3980496d53e07326b0bc703c48caa
Fix: fd-cache: Assertion failure if cache not allocated

Issue
=====
When initializing a `flt.lttng-utils.debug-info` message iterator,
errors may occur before the initialization of the iterator's
`bt_fd_cache`. If that occurs, the iterator is destroyed using the
`debug_info_msg_iter_destroy()` function which calls the
`bt_fd_cache_fini()` function. Leading to the `fdc->cache` being NULL
and thus triggering an assertion failure.

Solution
========
Change the `BT_ASSERT()` to an early return.

Drawbacks
=========
None.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ib6abd595f1c4365836cacd0357c7323f0b4c6385
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2044
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/fd-cache/fd-cache.c
This page took 0.024841 seconds and 4 git commands to generate.