tsm: unicode: fix not recreating the default-table all the time
authorDavid Herrmann <dh.herrmann@googlemail.com>
Thu, 27 Sep 2012 10:11:52 +0000 (12:11 +0200)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Thu, 27 Sep 2012 10:11:52 +0000 (12:11 +0200)
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 <dh.herrmann@googlemail.com>
src/tsm_unicode.c

index fcb296a..54bacfc 100644 (file)
@@ -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)