Cleanup: avoid duplicating userspace-probe desc twice
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 27 Aug 2018 21:13:07 +0000 (17:13 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 29 Aug 2018 20:36:06 +0000 (16:36 -0400)
commitcc8313098a2e4e28b0bae7539dd234d8b9fe6211
tree082e952bda0fbab94b6c4e3f01df9334748196a3
parent1f0a845dc223e765b4f42fd5064ff1da6a0c203e
Cleanup: avoid duplicating userspace-probe desc twice

In userspace probe location _copy functions, we duplicate the strings
(e.g. function name, provider name, etc.) before passing those new
strings to the *_create_no_check function. But this function also duplicates
those strings.

To remove this double duplication, we remove the calls to lttng_strndup() in
the _copy functions and pass the pointers to those strings directly to
the _create_no_check functions.

Also, we now don't call open() needlessly when calling the
_create_no_check functions from the _copy functions as we need to
manually set a duplicated fd (using dup(2)) to avoid file unlink race.

Fixes Coverity resource leak issues: 1395196139519213952051395211
and 1395214
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/userspace-probe.c
This page took 0.02665 seconds and 5 git commands to generate.