Use gwbuf_make_contiguous only with non-NULL buffers

A NULL buffer should never be made contiguous as that points to a flaw in
program logic.
This commit is contained in:
Markus Mäkelä 2018-07-23 09:23:17 +03:00
parent 37f32464f2
commit 896c7deb03
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -1600,11 +1600,11 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF
// Process client request one packet at a time
packetbuf = modutil_get_next_MySQL_packet(p_readbuf);
// TODO: Do this only when RCAP_TYPE_CONTIGUOUS_INPUT is requested
packetbuf = gwbuf_make_contiguous(packetbuf);
if (packetbuf != NULL)
{
// TODO: Do this only when RCAP_TYPE_CONTIGUOUS_INPUT is requested
packetbuf = gwbuf_make_contiguous(packetbuf);
CHK_GWBUF(packetbuf);
MySQLProtocol* proto = (MySQLProtocol*)session->client_dcb->protocol;