Fix incorrect memory order on refcounted strings

Former-commit-id: fcf3368b1d56ad7a11e510e5a66e415a46277e8b
This commit is contained in:
John Sully 2021-03-14 19:42:56 +00:00
parent 1f1f5bdc91
commit 718c31000e

View File

@ -195,7 +195,7 @@ void sdsfree(const char *s) {
if ((flags & SDS_TYPE_MASK) == SDS_TYPE_REFCOUNTED)
{
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;
}
s_free((char*)s-sdsHdrSize(s[-1]));