X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=c8d60cddcaee5e5bd9e2323c680c5dc710104cfc;hp=eff08df80ee937c46177765bf518f739a1d5d2a7;hb=5e4f4898bca7f9520da9a450c476b6148ea7d49c;hpb=ff75c11e409c084f513046c7dd2071e4750081d9 diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index eff08df80..c8d60cddc 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -1959,6 +1959,11 @@ int lttng_list_events(struct lttng_handle *handle, goto end; } + if (!cmd_header) { + ret = -LTTNG_ERR_UNK; + goto end; + } + /* Set number of events and free command header */ nb_events = cmd_header->nb_events; if (nb_events > INT_MAX) { @@ -2034,7 +2039,6 @@ int lttng_list_events(struct lttng_handle *handle, probe_storage_req = ret; comm_ext_at += ext_comm->userspace_probe_location_len; - ret = 0; } storage_req += sizeof(struct lttng_event_extended); @@ -2110,6 +2114,7 @@ int lttng_list_events(struct lttng_handle *handle, ext_comm->nb_exclusions * LTTNG_SYMBOL_NAME_LEN); if (ret) { ret = -LTTNG_ERR_NOMEM; + goto free_dynamic_buffer; } comm_ext_at += ext_comm->nb_exclusions * LTTNG_SYMBOL_NAME_LEN; }