From: Jérémie Galarneau Date: Wed, 20 May 2020 19:56:03 +0000 (-0400) Subject: Fix: liblttng-ctl: leak of tracker handle in lttng_[un]track_pid X-Git-Tag: v2.13.0-rc1~646 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=403e01ee4af47ae897fe42f1ed420648027022ae Fix: liblttng-ctl: leak of tracker handle in lttng_[un]track_pid The lttng_track_pid and lttng_untrack_pid functions were reimplemented on top of the new lttng_process_attr_tracker_handle API (new in 2.12). Both functions do not destroy the tracker handle on their return path. Signed-off-by: Jérémie Galarneau Change-Id: Ieeeace2011ba6ee1e5024306ea735f0389c3980d --- diff --git a/src/lib/lttng-ctl/tracker.c b/src/lib/lttng-ctl/tracker.c index 3f852fe72..4f720ead8 100644 --- a/src/lib/lttng-ctl/tracker.c +++ b/src/lib/lttng-ctl/tracker.c @@ -574,6 +574,7 @@ int lttng_track_pid(struct lttng_handle *handle, int pid) (pid_t) pid); ret_code = handle_status_to_error_code(handle_status); end: + lttng_process_attr_tracker_handle_destroy(tracker_handle); return ret_code == LTTNG_OK ? 0 : -ret_code; } @@ -637,6 +638,7 @@ int lttng_untrack_pid(struct lttng_handle *handle, int pid) ret_code = LTTNG_ERR_PID_NOT_TRACKED; } end: + lttng_process_attr_tracker_handle_destroy(tracker_handle); return ret_code == LTTNG_OK ? 0 : -ret_code; }