xkbcomp/ast-build: fix memory leak when appending multi-keysyms

`syms` was not freed.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2017-12-12 14:43:24 +02:00
parent 26453b8473
commit 2963e29f0e
2 changed files with 4 additions and 3 deletions

View File

@ -110,6 +110,9 @@ typedef darray (unsigned long) darray_ulong;
#define darray_copy(arr_to, arr_from) \
darray_from_items((arr_to), (arr_from).item, (arr_from).size)
#define darray_concat(arr_to, arr_from) \
darray_append_items((arr_to), (arr_from).item, (arr_from).size)
/*** String buffer ***/
#define darray_append_string(arr, str) do { \

View File

@ -226,14 +226,12 @@ ExprAppendKeysymList(ExprDef *expr, xkb_keysym_t sym)
ExprDef *
ExprAppendMultiKeysymList(ExprDef *expr, ExprDef *append)
{
xkb_keysym_t *syms;
unsigned nSyms = darray_size(expr->keysym_list.syms);
unsigned numEntries = darray_size(append->keysym_list.syms);
darray_append(expr->keysym_list.symsMapIndex, nSyms);
darray_append(expr->keysym_list.symsNumEntries, numEntries);
darray_steal(append->keysym_list.syms, &syms, NULL);
darray_append_items(expr->keysym_list.syms, syms, numEntries);
darray_concat(expr->keysym_list.syms, append->keysym_list.syms);
FreeStmt((ParseCommon *) &append);