Fix: session-descriptor.c: Dereference before null check
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 1 Oct 2019 18:21:00 +0000 (14:21 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 3 Oct 2019 00:31:33 +0000 (20:31 -0400)
Coverity report:
  CID 1400682 (#1 of 1): Dereference before null check
  (REVERSE_INULL)check_after_deref: Null-checking descriptor suggests that
  it may be null, but it has already been dereferenced on all paths
  leading to the check.

Reported-by: (1400682) Dereference before null check
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/session-descriptor.c

index 713731c3e222590d9a92085cd349d9fadc0264d4..6dea5ee7c09de528ed998113f64502f7748ea75e 100644 (file)
@@ -522,6 +522,10 @@ _lttng_session_descriptor_live_network_create(
 
        descriptor = _lttng_session_descriptor_live_create(name,
                        live_timer_interval_us);
 
        descriptor = _lttng_session_descriptor_live_create(name,
                        live_timer_interval_us);
+       if (!descriptor) {
+               goto error;
+       }
+
        descriptor->base.output_type =
                        LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK;
 
        descriptor->base.output_type =
                        LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK;
 
This page took 0.040324 seconds and 4 git commands to generate.