The caller of cmd_register_trigger assumes that no triggers are returned
on error. This causes a leak of the reference to the returned trigger.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I7377f9d4227c85feadba1778cf3c910ac677adac
* reference to the trigger so the caller doesn't have to care if those
* are distinct instances or not.
*/
- lttng_trigger_get(trigger);
- *return_trigger = trigger;
- /* Ownership of trigger was transferred to caller. */
- trigger = NULL;
+ if (ret_code == LTTNG_OK) {
+ lttng_trigger_get(trigger);
+ *return_trigger = trigger;
+ /* Ownership of trigger was transferred to caller. */
+ trigger = NULL;
+ }
end:
return ret_code;
end_unlock_session_list: