Fix gwbuf_apped assertion on writeq drain

The DCB writeq would be the tail pointer and it would be NULL.
This commit is contained in:
Markus Mäkelä
2019-05-21 11:50:14 +03:00
parent 6667dbed18
commit c4fff21909
2 changed files with 2 additions and 2 deletions

View File

@ -272,7 +272,7 @@ extern int gwbuf_compare(const GWBUF* lhs, const GWBUF* rhs);
* Append a buffer onto a linked list of buffer structures. * Append a buffer onto a linked list of buffer structures.
* *
* @param head The current head of the linked list or NULL. * @param head The current head of the linked list or NULL.
* @param tail Another buffer to make the tail of the linked list * @param tail Another buffer to make the tail of the linked list, must not be NULL
* *
* @return The new head of the linked list * @return The new head of the linked list
*/ */

View File

@ -986,7 +986,7 @@ int dcb_drain_writeq(DCB* dcb)
*/ */
if (stop_writing) if (stop_writing)
{ {
dcb->writeq = gwbuf_append(local_writeq, dcb->writeq); dcb->writeq = dcb->writeq ? gwbuf_append(local_writeq, dcb->writeq) : local_writeq;
local_writeq = NULL; local_writeq = NULL;
} }
else else