-
Committer:
Jérémie Galarneau
-
Author(s):
Francis Deslauriers
-
Date:
2019-08-23 00:44:13 UTC
-
Revision ID:
git-v1:3e83e4f2f656b3edee71cb33ce24bd3cf998f51c
Fix: sink.ctf.fs: possible use-after-free
Issue
=====
We might use of `trace` pointer after freeing it in the error path.
Solution
========
Move the `fclose()` call (and surroundings) before the `end` label as
the `fh` pointer is only initialized after the only possible `goto end`.
Reported-by: scan-build - Use of memory after it is freed
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I8f346b45a76ce976019931f9c63c20dd18a88d86
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1968
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>