MXS-1953: Always initialize the GWBUF spinlock
The spinlock in the buffer is used but it was not always initialized. Also added missing initialization of the SERVER pointer.
This commit is contained in:
@ -88,6 +88,7 @@ gwbuf_alloc(unsigned int size)
|
||||
rval->hint = NULL;
|
||||
rval->properties = NULL;
|
||||
rval->gwbuf_type = GWBUF_TYPE_UNDEFINED;
|
||||
rval->server = NULL;
|
||||
CHK_GWBUF(rval);
|
||||
retblock:
|
||||
if (rval == NULL)
|
||||
@ -304,6 +305,8 @@ gwbuf_clone_one(GWBUF *buf)
|
||||
}
|
||||
|
||||
atomic_add(&buf->sbuf->refcount, 1);
|
||||
spinlock_init(&rval->gwbuf_lock);
|
||||
rval->server = buf->server;
|
||||
rval->sbuf = buf->sbuf;
|
||||
rval->start = buf->start;
|
||||
rval->end = buf->end;
|
||||
@ -385,6 +388,8 @@ static GWBUF *gwbuf_clone_portion(GWBUF *buf,
|
||||
return NULL;
|
||||
}
|
||||
atomic_add(&buf->sbuf->refcount, 1);
|
||||
spinlock_init(&clonebuf->gwbuf_lock);
|
||||
clonebuf->server = buf->server;
|
||||
clonebuf->sbuf = buf->sbuf;
|
||||
clonebuf->gwbuf_type = buf->gwbuf_type; /*< clone info bits too */
|
||||
clonebuf->start = (void *)((char*)buf->start + start_offset);
|
||||
|
Reference in New Issue
Block a user