test: fix missing va_end in case of test failures Found by coverity 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 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
diff --git a/test/registry.c b/test/registry.c
index fab3b69..25a5638 100644
--- a/test/registry.c
+++ b/test/registry.c
@@ -282,18 +282,21 @@ find_models(struct rxkb_context *ctx, ...)
va_list args;
const char *name;
int idx = 0;
+ bool rc = false;
va_start(args, ctx);
name = va_arg(args, const char *);
while(name) {
assert(++idx < 20); /* safety guard */
if (!find_model(ctx, name))
- return false;
+ goto out;
name = va_arg(args, const char *);
};
+ rc = true;
+out:
va_end(args);
- return true;
+ return rc;
}
static struct rxkb_layout *
@@ -326,6 +329,7 @@ find_layouts(struct rxkb_context *ctx, ...)
va_list args;
const char *name, *variant;
int idx = 0;
+ bool rc = false;
va_start(args, ctx);
name = va_arg(args, const char *);
@@ -333,14 +337,16 @@ find_layouts(struct rxkb_context *ctx, ...)
while(name) {
assert(++idx < 20); /* safety guard */
if (!find_layout(ctx, name, variant))
- return false;
+ goto out;
name = va_arg(args, const char *);
if (name)
variant = va_arg(args, const char *);
};
+ rc = true;
+out:
va_end(args);
- return true;
+ return rc;
}
static struct rxkb_option_group *
@@ -396,6 +402,7 @@ find_options(struct rxkb_context *ctx, ...)
va_list args;
const char *grp, *opt;
int idx = 0;
+ bool rc = false;
va_start(args, ctx);
grp = va_arg(args, const char *);
@@ -403,14 +410,16 @@ find_options(struct rxkb_context *ctx, ...)
while(grp) {
assert(++idx < 20); /* safety guard */
if (!find_option(ctx, grp, opt))
- return false;
+ goto out;
grp = va_arg(args, const char *);
if (grp)
opt = va_arg(args, const char *);
};
+ rc = true;
+out:
va_end(args);
- return true;
+ return rc;
}
static bool