diff --git a/src/symbol.c b/src/symbol.c index 62057ab7..816e72bc 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -21,6 +21,8 @@ pic_intern_cstr(pic_state *pic, const char *str) return e->val; } + str = pic_strdup(pic, str); + if (pic->slen >= pic->scapa) { #if DEBUG @@ -31,7 +33,7 @@ pic_intern_cstr(pic_state *pic, const char *str) pic->sym_pool = pic_realloc(pic, pic->sym_pool, sizeof(const char *) * pic->scapa); } id = pic->slen++; - pic->sym_pool[id] = pic_strdup(pic, str); + pic->sym_pool[id] = str; xh_put(pic->sym_tbl, str, id); return id; }