From fdca25db9f1db6cc8cd4ff65a71718d31c4ec860 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Fri, 24 Apr 2015 17:57:00 +0300 Subject: [PATCH] Revert "modutil_get_complete_packets now partially clones the buffer instead of allocating a new one." This reverts commit b62f7f942bde10ea7d69d933c03513e315891d02. --- server/core/modutil.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/server/core/modutil.c b/server/core/modutil.c index 82890e334..a0afb5622 100644 --- a/server/core/modutil.c +++ b/server/core/modutil.c @@ -549,6 +549,7 @@ GWBUF* modutil_get_complete_packets(GWBUF** p_readbuf) packet->next = NULL; *p_readbuf = packet; ptr = (uint8_t*)packet->start; + end = (uint8_t*)packet->end; len = gw_mysql_get_byte3(ptr) + 4; blen = gwbuf_length(packet); @@ -577,13 +578,18 @@ GWBUF* modutil_get_complete_packets(GWBUF** p_readbuf) } /** The next packet is a partial, split into complete and partial packets */ - if((buff = gwbuf_clone_portion(packet,0,total)) == NULL) + if((buff = gwbuf_alloc(total)) == NULL) { skygw_log_write(LOGFILE_ERROR, - "Error: Failed to partially clone buffer."); + "Error: Failed to allocate new buffer " + " of %d bytes while splitting buffer" + " into complete packets.", + total); return NULL; } - + buff->next = NULL; + gwbuf_set_type(buff,GWBUF_TYPE_MYSQL); + memcpy(buff->start,packet->start,total); gwbuf_consume(packet,total); return buff; }