X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=d8e2f1428df7fc27560b532c5b3c41ca478c60f8;hb=de8218d45188782cd920e9871f759a54aee1b8cb;hp=c79cc6dd59eb251a7b5c237b1dd7e4c4108dcbe3;hpb=56f0bc67599b5438a4b68bdbec596aaaa39b2e7e;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index c79cc6dd5..d8e2f1428 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -1033,6 +1033,9 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle, bool send_fd = false; unsigned int free_filter_expression = 0; struct filter_parser_ctx *ctx = NULL; + + memset(&send_buffer, 0, sizeof(send_buffer)); + /* * Cast as non-const since we may replace the filter expression * by a dynamically allocated string. Otherwise, the original @@ -1956,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) { @@ -2031,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); @@ -2107,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; } @@ -2719,7 +2727,7 @@ int lttng_list_tracker_pids(struct lttng_handle *handle, int enabled = 1; struct lttcomm_session_msg lsm; size_t nr_pids; - int32_t *pids; + int32_t *pids = NULL; if (handle == NULL) { return -LTTNG_ERR_INVALID; @@ -2736,6 +2744,9 @@ int lttng_list_tracker_pids(struct lttng_handle *handle, return ret; } nr_pids = ret / sizeof(int32_t); + if (nr_pids > 0 && !pids) { + return -LTTNG_ERR_UNK; + } if (nr_pids == 1 && pids[0] == -1) { free(pids); pids = NULL;