X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=lttng-context-perf-counters.c;h=2f7132fbf26bf8db8aa9897fbfcee73cbc97e143;hb=44252f0fd51fd4bf28926dcef525355bceb08c5f;hp=5327e6ef06956707a914d15c3d56e9924291d06b;hpb=96ba7208aa8009345a525148e32f78cd8d4693ab;p=lttng-modules.git diff --git a/lttng-context-perf-counters.c b/lttng-context-perf-counters.c index 5327e6ef..2f7132fb 100644 --- a/lttng-context-perf-counters.c +++ b/lttng-context-perf-counters.c @@ -170,6 +170,10 @@ int lttng_add_perf_counter_to_ctx(uint32_t type, ret = -ENOMEM; goto append_context_error; } + if (lttng_find_context(*ctx, name_alloc)) { + ret = -EEXIST; + goto find_error; + } #ifdef CONFIG_HOTPLUG_CPU field->u.perf_counter.nb.notifier_call = @@ -217,6 +221,7 @@ counter_error: #ifdef CONFIG_HOTPLUG_CPU unregister_cpu_notifier(&field->u.perf_counter.nb); #endif +find_error: lttng_remove_context_field(ctx, field); append_context_error: kfree(name_alloc);