From d6f2d8ecd07984a2c8725090acb806a16b51738a Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 28 May 2014 20:32:16 +0300 Subject: rules: fix leak on failure matcher_match() builds up the kccgst's, and we steal the memory on success. But on error we didn't free it. Signed-off-by: Ran Benita --- src/xkbcomp/rules.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c index 61799e7..39125da 100644 --- a/src/xkbcomp/rules.c +++ b/src/xkbcomp/rules.c @@ -309,6 +309,8 @@ matcher_free(struct matcher *m) darray_free(m->rmlvo.options); darray_foreach(group, m->groups) darray_free(group->elements); + for (int i = 0; i < _KCCGST_NUM_ENTRIES; i++) + darray_free(m->kccgst[i]); darray_free(m->groups); free(m); } @@ -950,6 +952,8 @@ finish: /* out->geometry = darray_mem(m->kccgst[KCCGST_GEOMETRY], 0); */ darray_free(m->kccgst[KCCGST_GEOMETRY]); out->symbols = darray_mem(m->kccgst[KCCGST_SYMBOLS], 0); + for (int i = 0; i < _KCCGST_NUM_ENTRIES; i++) + darray_init(m->kccgst[i]); return true; -- cgit v1.2.3