LTTNG_HIDDEN
ssize_t lttng_trigger_create_from_payload(
struct lttng_payload_view *src_view,
- struct lttng_trigger **trigger)
+ struct lttng_trigger **_trigger)
{
ssize_t ret, offset = 0, condition_size, action_size, name_size = 0;
struct lttng_condition *condition = NULL;
.uid = LTTNG_OPTIONAL_INIT_UNSET,
.gid = LTTNG_OPTIONAL_INIT_UNSET,
};
+ struct lttng_trigger *trigger = NULL;
const struct lttng_payload_view trigger_comm_view =
lttng_payload_view_from_view(
src_view, 0, sizeof(*trigger_comm));
- if (!src_view || !trigger) {
+ if (!src_view || !_trigger) {
ret = -1;
goto end;
}
goto error;
}
- *trigger = lttng_trigger_create(condition, action);
- if (!*trigger) {
+ trigger = lttng_trigger_create(condition, action);
+ if (!trigger) {
ret = -1;
goto error;
}
- lttng_trigger_set_credentials(*trigger, &creds);
+ lttng_trigger_set_credentials(trigger, &creds);
/*
* The trigger object owns references to the action and condition
if (name) {
const enum lttng_trigger_status status =
- lttng_trigger_set_name(*trigger, name);
+ lttng_trigger_set_name(trigger, name);
if (status != LTTNG_TRIGGER_STATUS_OK) {
ret = -1;
lttng_condition_put(condition);
lttng_action_put(action);
end:
+ if (ret == 0) {
+ *_trigger = trigger;
+ } else {
+ lttng_trigger_put(trigger);
+ }
+
return ret;
}