Commit 7a205e25ac3b3a69bb12316a096eb1bab35a2702

Peter Hutterer 2021-03-18T11:08:16

bench: silence coverity complaint about a double free False positive because we rely on xkb_components_from_rules() to initalize this struct, but let's localize the variable anyway to shut coverity up. libxkbcommon-1.0.3/bench/rules.c:59:9: warning[-Wanalyzer-double-free]: double-free of kccgst.symbols Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/bench/rules.c b/bench/rules.c
index 3206583..1306dc4 100644
--- a/bench/rules.c
+++ b/bench/rules.c
@@ -40,7 +40,6 @@ main(int argc, char *argv[])
     struct xkb_rule_names rmlvo = {
         "evdev", "pc105", "us,il", ",", "ctrl:nocaps,grp:menu_toggle",
     };
-    struct xkb_component_names kccgst;
     struct bench bench;
     char *elapsed;
 
@@ -52,6 +51,8 @@ main(int argc, char *argv[])
 
     bench_start(&bench);
     for (i = 0; i < BENCHMARK_ITERATIONS; i++) {
+        struct xkb_component_names kccgst;
+
         assert(xkb_components_from_rules(ctx, &rmlvo, &kccgst));
         free(kccgst.keycodes);
         free(kccgst.types);