Commit 01aa2222576c88308d74bbc7f0c459d4acada681

Peter Hutterer 2021-03-18T11:22:38

registry: plug a potential memleak for invalid rules files If the name is missing in a configItem, we'd fail and leak the memory for description, brief and vendor. 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
diff --git a/src/registry.c b/src/registry.c
index dcaaa1b..7198828 100644
--- a/src/registry.c
+++ b/src/registry.c
@@ -742,6 +742,10 @@ parse_config_item(struct rxkb_context *ctx,
             if (!*name || !strlen(*name))  {
                 log_err(ctx, "xml:%d: missing required element 'name'\n",
                         ci->line);
+                free(*name);
+                free(*description);
+                free(*brief);
+                free(*vendor);
                 return false;
             }