Revert "modutil_get_complete_packets now partially clones the buffer instead of allocating a new one."

This reverts commit b62f7f942bde10ea7d69d933c03513e315891d02.
This commit is contained in:
Markus Makela 2015-04-24 17:57:00 +03:00
parent 62ebf542d5
commit fdca25db9f

View File

@ -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;
}