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>
Wed, 4 Sep 2019 15:58:22 +0000 (11:58 -0400)
commit394ebca9d7db34decb3223dee2de78420a287a18
treeb1a22eb092d13bfc636a4f36c3f4fa23c7009151
parent653f9b416b7c0a3f8e32ea53889ecf43930eff93
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.024185 seconds and 4 git commands to generate.