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