Commit 80140fa0 authored by antirez's avatar antirez
Browse files

Fix hllSparseAdd() new sequence replacement when next is NULL.

sdsIncrLen() must be called anyway even if we are replacing the last
oppcode of the sparse representation.
parent 3c3c1656
...@@ -784,10 +784,8 @@ int hllSparseAdd(robj *o, unsigned char *ele, size_t elesize) { ...@@ -784,10 +784,8 @@ int hllSparseAdd(robj *o, unsigned char *ele, size_t elesize) {
int deltalen = seqlen-oldlen; int deltalen = seqlen-oldlen;
if (deltalen > 0 && sdslen(o->ptr) > HLL_SPARSE_MAX) goto promote; if (deltalen > 0 && sdslen(o->ptr) > HLL_SPARSE_MAX) goto promote;
if (deltalen && next) { if (deltalen && next) memmove(next+deltalen,next,next-sparse);
memmove(next+deltalen,next,next-sparse); sdsIncrLen(o->ptr,deltalen);
sdsIncrLen(o->ptr,deltalen);
}
memcpy(p,seq,seqlen); memcpy(p,seq,seqlen);
updated: updated:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment