The trace_ust inclusion set add/remove methods do not jump to the
end label after checking the `tracker` variable. This can result
in a NULL pointer dereference when an invalid process attribute
is specified.
The same problem appears in save_process_attr_trackers() and
process_attr_value_from_comm().
The missing jump (goto) is added in all cases.
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I473e008e5330a4c3820c8ab7c57ce4f2961e79b2
break;
default:
ret = LTTNG_ERR_INVALID;
+ goto end;
}
ret = LTTNG_OK;
end:
tracker = _trace_ust_get_process_attr_tracker(session, process_attr);
if (!tracker) {
ret_code = LTTNG_ERR_INVALID;
+ goto end;
}
status = process_attr_tracker_inclusion_set_add_value(tracker, value);
tracker = _trace_ust_get_process_attr_tracker(session, process_attr);
if (!tracker) {
ret_code = LTTNG_ERR_INVALID;
+ goto end;
}
status = process_attr_tracker_inclusion_set_remove_value(
name = strdup(value_view->data);
if (!name) {
ret = LTTNG_ERR_NOMEM;
+ goto error;
}
}