Fix setDeferredMultiBulkLength() c->reply_bytes handling with EMBSTR

This function missed proper handling of reply_bytes when gluing to the
previous object was used. The issue was introduced with the EMBSTR new
string object encoding.

This fixes issue #1208.
This commit is contained in:
antirez 2013-07-22 23:27:56 +02:00
parent 7ed7652846
commit dbaa5b0b9a

View File

@ -413,7 +413,10 @@ void setDeferredMultiBulkLength(redisClient *c, void *node, long length) {
/* Only glue when the next node is non-NULL (an sds in this case) */
if (next->ptr != NULL) {
c->reply_bytes -= zmalloc_size_sds(len->ptr);
c->reply_bytes -= zmalloc_size_sds(next->ptr);
if (next->encoding == REDIS_ENCODING_RAW)
c->reply_bytes -= zmalloc_size_sds(next->ptr);
else
c->reply_bytes -= sdslen(next->ptr);
len->ptr = sdscatlen(len->ptr,next->ptr,sdslen(next->ptr));
c->reply_bytes += zmalloc_size_sds(len->ptr);
listDelNode(c->reply,ln->next);