X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fevent-rule%2Fuser-tracepoint.cpp;h=48040fc59292384310ae1ac4fb19e0332266b08b;hb=3691d312bcf4dc2cc15f0ecb1f0e2fd2f34315b8;hp=5158eeaa072c992a57aa777e4ee8fe0552ea40b5;hpb=a6bc4ca9d659caf016ef932fcd944029737ac57c;p=lttng-tools.git diff --git a/src/common/event-rule/user-tracepoint.cpp b/src/common/event-rule/user-tracepoint.cpp index 5158eeaa0..48040fc59 100644 --- a/src/common/event-rule/user-tracepoint.cpp +++ b/src/common/event-rule/user-tracepoint.cpp @@ -5,19 +5,19 @@ * */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -362,8 +362,7 @@ lttng_event_rule_user_tracepoint_generate_exclusions( goto end; } - exclusions = (lttng_event_exclusion *) zmalloc(sizeof(struct lttng_event_exclusion) + - (LTTNG_SYMBOL_NAME_LEN * nb_exclusions)); + exclusions = zmalloc(sizeof(struct lttng_event_exclusion) + (LTTNG_SYMBOL_NAME_LEN * nb_exclusions)); if (!exclusions) { PERROR("Failed to allocate exclusions buffer"); ret_status = LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_OUT_OF_MEMORY; @@ -380,8 +379,10 @@ lttng_event_rule_user_tracepoint_generate_exclusions( rule, i, &exclusion_str); LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK); - copy_ret = lttng_strncpy(exclusions->names[i], exclusion_str, - LTTNG_SYMBOL_NAME_LEN); + copy_ret = lttng_strncpy( + LTTNG_EVENT_EXCLUSION_NAME_AT(exclusions, i), + exclusion_str, + sizeof(LTTNG_EVENT_EXCLUSION_NAME_AT(exclusions, i))); if (copy_ret) { free(exclusions); exclusions = NULL; @@ -558,7 +559,7 @@ struct lttng_event_rule *lttng_event_rule_user_tracepoint_create(void) struct lttng_event_rule_user_tracepoint *tp_rule; enum lttng_event_rule_status status; - tp_rule = (lttng_event_rule_user_tracepoint *) zmalloc(sizeof(struct lttng_event_rule_user_tracepoint)); + tp_rule = zmalloc(); if (!tp_rule) { goto end; }