From 090ead3bd6a9771ec5c2edea23bba8d9c161172b Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Thu, 27 Sep 2012 12:11:52 +0200 Subject: [PATCH] tsm: unicode: fix not recreating the default-table all the time We actually created a new table all the time which led to huge memory leaks. We now actually use the default table if it is available. Signed-off-by: David Herrmann --- src/tsm_unicode.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tsm_unicode.c b/src/tsm_unicode.c index fcb296a..54bacfc 100644 --- a/src/tsm_unicode.c +++ b/src/tsm_unicode.c @@ -233,6 +233,9 @@ const uint32_t *tsm_symbol_get(struct tsm_symbol_table *tbl, return sym; } + if (!tbl) + tbl = tsm_symbol_table_default; + if (!tbl) { ret = tsm_symbol_table_new(&tbl); if (ret) { @@ -270,6 +273,9 @@ tsm_symbol_t tsm_symbol_append(struct tsm_symbol_table *tbl, bool res; int ret; + if (!tbl) + tbl = tsm_symbol_table_default; + if (!tbl) { ret = tsm_symbol_table_new(&tbl); if (ret) -- 2.7.4