Fix use-after-free in buffer.c

The fix to MXS-1338 added a bug where the buffer objects were freed after
the shared buffer was freed.
This commit is contained in:
Markus Mäkelä 2017-08-02 17:55:35 +03:00
parent 63b16243e7
commit bda1c5d55d

View File

@ -257,8 +257,6 @@ gwbuf_free_one(GWBUF *buf)
if (atomic_add(&buf->sbuf->refcount, -1) == 1)
{
MXS_FREE(buf->sbuf->data);
MXS_FREE(buf->sbuf);
bo = buf->sbuf->bufobj;
while (bo != NULL)
@ -266,7 +264,10 @@ gwbuf_free_one(GWBUF *buf)
bo = gwbuf_remove_buffer_object(buf, bo);
}
MXS_FREE(buf->sbuf->data);
MXS_FREE(buf->sbuf);
}
while (buf->properties)
{
prop = buf->properties;