From: Francis Deslauriers Date: Tue, 1 Oct 2019 18:21:00 +0000 (-0400) Subject: Fix: session-descriptor.c: Dereference before null check X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=commitdiff_plain;h=ca258a7d30510f01d0760f4f529fed2bb5821b9a Fix: session-descriptor.c: Dereference before null check 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 Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/session-descriptor.c b/src/common/session-descriptor.c index 713731c3e..6dea5ee7c 100644 --- a/src/common/session-descriptor.c +++ b/src/common/session-descriptor.c @@ -522,6 +522,10 @@ _lttng_session_descriptor_live_network_create( 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;