mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
字符串引用计数BUG
This commit is contained in:
@@ -335,8 +335,11 @@ markref(struct ssm_ref *r, TString *s, int changeref) {
|
|||||||
unsigned int h = s->hash;
|
unsigned int h = s->hash;
|
||||||
int slot = lmod(h, r->hsize);
|
int slot = lmod(h, r->hsize);
|
||||||
TString * hs = r->hash[slot];
|
TString * hs = r->hash[slot];
|
||||||
if (hs == s)
|
if (hs == s){
|
||||||
|
if (changeref)
|
||||||
|
DEC_SREF(s);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
++r->nuse;
|
++r->nuse;
|
||||||
if (r->nuse >= r->hsize && r->hsize <= MAX_INT/2) {
|
if (r->nuse >= r->hsize && r->hsize <= MAX_INT/2) {
|
||||||
expand_ref(r, changeref);
|
expand_ref(r, changeref);
|
||||||
@@ -346,6 +349,8 @@ markref(struct ssm_ref *r, TString *s, int changeref) {
|
|||||||
if (hs != NULL) {
|
if (hs != NULL) {
|
||||||
if (hs == s) {
|
if (hs == s) {
|
||||||
--r->nuse;
|
--r->nuse;
|
||||||
|
if (changeref)
|
||||||
|
DEC_SREF(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
insert_ref(r, hs);
|
insert_ref(r, hs);
|
||||||
|
|||||||
Reference in New Issue
Block a user