create_kernel_session() will call trace_kernel_destroy_session()
on failure to create a kernel session (e.g. modules failed to load).
This can be reproduced by enabling kernel events on a session after
the session daemon has failed to load the LTTng kernel modules.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
ret = kernel_create_session(session, kernel_tracer_fd);
if (ret < 0) {
ret = LTTNG_ERR_KERN_SESS_FAIL;
- goto error;
+ goto error_create;
}
/* Code flow safety */
error:
trace_kernel_destroy_session(session->kernel_session);
session->kernel_session = NULL;
+error_create:
return ret;
}