From dbaa5b0b9a0a68cb44f32b6fcc8d9dbf0b2fc49d Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 22 Jul 2013 23:27:56 +0200 Subject: [PATCH] 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. --- src/networking.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/networking.c b/src/networking.c index a9f01686..847e80c1 100644 --- a/src/networking.c +++ b/src/networking.c @@ -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);