字符串引用计数BUG

This commit is contained in:
hong
2019-05-25 15:32:51 +08:00
committed by 云风
parent a8c1828786
commit 1b60c522b0

View File

@@ -335,8 +335,11 @@ markref(struct ssm_ref *r, TString *s, int changeref) {
unsigned int h = s->hash;
int slot = lmod(h, r->hsize);
TString * hs = r->hash[slot];
if (hs == s)
if (hs == s){
if (changeref)
DEC_SREF(s);
return;
}
++r->nuse;
if (r->nuse >= r->hsize && r->hsize <= MAX_INT/2) {
expand_ref(r, changeref);
@@ -346,6 +349,8 @@ markref(struct ssm_ref *r, TString *s, int changeref) {
if (hs != NULL) {
if (hs == s) {
--r->nuse;
if (changeref)
DEC_SREF(s);
return;
}
insert_ref(r, hs);