Fix: sink.ctf.fs: possible use-after-free
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 20 Aug 2019 03:21:57 +0000 (23:21 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 23 Aug 2019 00:44:13 +0000 (20:44 -0400)
commit3e83e4f2f656b3edee71cb33ce24bd3cf998f51c
tree803b36bfccfdc283d78c42daa239aac7df833db1
parent8a08b7c044e8717ef0d2cc88ef441578bf01d3ed
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>
src/plugins/ctf/fs-sink/fs-sink-trace.c
This page took 0.024483 seconds and 4 git commands to generate.