From c4fff21909b111b81f94032c145075dcc9ddcc9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 21 May 2019 11:50:14 +0300 Subject: [PATCH] Fix gwbuf_apped assertion on writeq drain The DCB writeq would be the tail pointer and it would be NULL. --- include/maxscale/buffer.hh | 2 +- server/core/dcb.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/maxscale/buffer.hh b/include/maxscale/buffer.hh index 95e84f447..619aed780 100644 --- a/include/maxscale/buffer.hh +++ b/include/maxscale/buffer.hh @@ -272,7 +272,7 @@ extern int gwbuf_compare(const GWBUF* lhs, const GWBUF* rhs); * Append a buffer onto a linked list of buffer structures. * * @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 */ diff --git a/server/core/dcb.cc b/server/core/dcb.cc index 445191a0d..88f14bdab 100644 --- a/server/core/dcb.cc +++ b/server/core/dcb.cc @@ -986,7 +986,7 @@ int dcb_drain_writeq(DCB* dcb) */ 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; } else