[bugfix] pic_intern must count up reference of the return value

This commit is contained in:
Yuichi Nishiwaki
2015-01-19 14:37:47 +09:00
parent 44ff702e60
commit 772a5ceae5
+3 -1
View File
@@ -25,7 +25,9 @@ pic_intern(pic_state *pic, pic_str *str)
e = xh_get_str(&pic->syms, pic_str_cstr(str));
if (e) {
return xh_val(e, pic_sym);
sym = xh_val(e, pic_sym);
pic_gc_protect(pic, pic_obj_value(sym));
return sym;
}
cstr = pic_malloc(pic, pic_strlen(str) + 1);