From 6a0838b7bdcc04613f703dc6580f81beb849fa64 Mon Sep 17 00:00:00 2001 From: Yannick Lamarre Date: Thu, 28 Mar 2019 15:07:43 -0400 Subject: [PATCH] Clean-up: Remove double buffer initialisation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Yannick Lamarre Signed-off-by: Jérémie Galarneau --- src/lib/lttng-ctl/lttng-ctl.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index bbff088e0..f50ca3061 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -1078,7 +1078,11 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle, unsigned int free_filter_expression = 0; struct filter_parser_ctx *ctx = NULL; - memset(&send_buffer, 0, sizeof(send_buffer)); + /* + * We have either a filter or some exclusions, so we need to set up + * a variable-length memory block from where to send the data. + */ + lttng_dynamic_buffer_init(&send_buffer); /* * Cast as non-const since we may replace the filter expression @@ -1128,12 +1132,6 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle, lsm.u.enable.exclusion_count = exclusion_count; lsm.u.enable.bytecode_len = 0; - /* - * We have either a filter or some exclusions, so we need to set up - * a variable-length memory block from where to send the data. - */ - lttng_dynamic_buffer_init(&send_buffer); - /* Parse filter expression. */ if (filter_expression != NULL || handle->domain.type == LTTNG_DOMAIN_JUL || handle->domain.type == LTTNG_DOMAIN_LOG4J -- 2.34.1