Fix incorrect memory order on refcounted strings
Former-commit-id: fcf3368b1d56ad7a11e510e5a66e415a46277e8b
This commit is contained in:
parent
1f1f5bdc91
commit
718c31000e
@ -195,7 +195,7 @@ void sdsfree(const char *s) {
|
|||||||
if ((flags & SDS_TYPE_MASK) == SDS_TYPE_REFCOUNTED)
|
if ((flags & SDS_TYPE_MASK) == SDS_TYPE_REFCOUNTED)
|
||||||
{
|
{
|
||||||
SDS_HDR_VAR_REFCOUNTED(s);
|
SDS_HDR_VAR_REFCOUNTED(s);
|
||||||
if (__atomic_fetch_sub(&sh->refcount, 1, __ATOMIC_RELAXED) > 1)
|
if (__atomic_fetch_sub(&sh->refcount, 1, __ATOMIC_ACQ_REL) > 1)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
s_free((char*)s-sdsHdrSize(s[-1]));
|
s_free((char*)s-sdsHdrSize(s[-1]));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user