Fix: dereference before null check of channel attributes
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 6 May 2017 18:34:42 +0000 (14:34 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 6 May 2017 18:34:42 +0000 (14:34 -0400)
Reported-by: Coverity Scan
CID 1374802 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking attr suggests that it may be null,
but it has already been dereferenced on all paths leading to the check.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/lib/lttng-ctl/lttng-ctl.c

index 469fffa980f33b6c527d94ac47e6fb51a3ce6f42..6bd3f80ec3f8f3a77941d30c67936b98c05efed3 100644 (file)
@@ -2047,14 +2047,14 @@ int lttng_calibrate(struct lttng_handle *handle,
 void lttng_channel_set_default_attr(struct lttng_domain *domain,
                struct lttng_channel_attr *attr)
 {
-       struct lttng_channel_extended *extended =
-                       (struct lttng_channel_extended *) attr->extended.ptr;
+       struct lttng_channel_extended *extended;
 
        /* Safety check */
        if (attr == NULL || domain == NULL) {
                return;
        }
 
+       extended = (struct lttng_channel_extended *) attr->extended.ptr;
        memset(attr, 0, sizeof(struct lttng_channel_attr));
 
        /* Same for all domains. */
This page took 0.026432 seconds and 4 git commands to generate.