Fix debug assertion in cache
The call to gwbuf_length will fail if the pointed to buffer isn't the head of the chain. To prevent this, the length is calculated before the buffer is appended. Also fixed the use of gwbuf_append. The return value should be assigned and the code shouldn't reply on the value passed to the function being correct.
This commit is contained in:
parent
7ad3485892
commit
ba289dc589
@ -358,10 +358,11 @@ int CacheFilterSession::clientReply(GWBUF* pData)
|
||||
|
||||
if (m_res.pData)
|
||||
{
|
||||
gwbuf_append(m_res.pData, pData);
|
||||
auto len = gwbuf_length(pData); // pData may be a chain, so not GWBUF_LENGTH().
|
||||
m_res.pData = gwbuf_append(m_res.pData, pData);
|
||||
m_res.pData_last = pData;
|
||||
m_res.offset_last = m_res.length;
|
||||
m_res.length += gwbuf_length(pData); // pData may be a chain, so not GWBUF_LENGTH().
|
||||
m_res.length += len;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user