Failures to create an MI writer instance will result in a dereference of
the MI writer when attempting to close the command's output element.
1457842 Dereference after null check
Either the check against null is unnecessary, or there may be a null
pointer dereference.
In cmd_add_trigger: Pointer is checked against null but then
dereferenced anyway (CWE-476)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I0bc71bf6c83df7d9d938cf93a12d5f6cf6d7ae36
end:
/* Mi closing. */
- if (lttng_opt_mi) {
+ if (lttng_opt_mi && mi_writer) {
/* Close output element. */
int mi_ret = mi_lttng_writer_close_element(mi_writer);
if (mi_ret) {