[lttng-dev] [PATCH lttng-tools] Fix: Deference after null check in sessiond set_option
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Tue May 17 13:32:46 UTC 2016
Found by Coverity:
2. var_compare_op: Comparing arg to null implies that arg might be null.
CID 1256137 (#1 of 9): Dereference after null check (FORWARD_NULL)14.
var_deref_model: Passing null pointer arg to strdup, which dereferences
it.
[... same for #2 through #9 ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
src/bin/lttng-sessiond/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
index 6081fb2..bdf2a74 100644
--- a/src/bin/lttng-sessiond/main.c
+++ b/src/bin/lttng-sessiond/main.c
@@ -4671,7 +4671,7 @@ static int set_option(int opt, const char *arg, const char *optname)
{
int ret = 0;
- if (arg && arg[0] == '\0') {
+ if (!arg || arg[0] == '\0') {
/*
* This only happens if the value is read from daemon config
* file. This means the option requires an argument and the
--
2.1.4
More information about the lttng-dev
mailing list