Comparing the return value of atomic_add instead of buffer's reference count variable.
This commit is contained in:
parent
cb20f8ab8d
commit
b673108276
@ -94,12 +94,11 @@ SHARED_BUF *sbuf;
|
||||
void
|
||||
gwbuf_free(GWBUF *buf)
|
||||
{
|
||||
atomic_add(&buf->sbuf->refcount, -1);
|
||||
CHK_GWBUF(buf);
|
||||
if (buf->sbuf->refcount == 0)
|
||||
CHK_GWBUF(buf);
|
||||
if (atomic_add(&buf->sbuf->refcount, -1) == 1)
|
||||
{
|
||||
free(buf->sbuf->data);
|
||||
free(buf->sbuf);
|
||||
free(buf->sbuf);
|
||||
}
|
||||
free(buf);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user