diff options
author | deep <ieshen.zheng@163.com> | 2016-10-28 19:47:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-28 19:47:29 +0800 |
commit | 7f1bb22ef3f77c940e6331512eeaddfdd1703be3 (patch) | |
tree | 063f6be4bc45898f662c35336c7ddd718f6cba70 /src/quicklist.c | |
parent | f39e7d4d7e8f3a0d5a8eb29e2bc86700a26397fd (diff) | |
download | redis-7f1bb22ef3f77c940e6331512eeaddfdd1703be3.tar.gz |
fix a bug for quicklistDup() function
Diffstat (limited to 'src/quicklist.c')
-rw-r--r-- | src/quicklist.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/quicklist.c b/src/quicklist.c index 9cb052525..c8b72743c 100644 --- a/src/quicklist.c +++ b/src/quicklist.c @@ -1192,12 +1192,12 @@ quicklist *quicklistDup(quicklist *orig) { current = current->next) { quicklistNode *node = quicklistCreateNode(); - if (node->encoding == QUICKLIST_NODE_ENCODING_LZF) { - quicklistLZF *lzf = (quicklistLZF *)node->zl; + if (current->encoding == QUICKLIST_NODE_ENCODING_LZF) { + quicklistLZF *lzf = (quicklistLZF *)current->zl; size_t lzf_sz = sizeof(*lzf) + lzf->sz; node->zl = zmalloc(lzf_sz); memcpy(node->zl, current->zl, lzf_sz); - } else if (node->encoding == QUICKLIST_NODE_ENCODING_RAW) { + } else if (current->encoding == QUICKLIST_NODE_ENCODING_RAW) { node->zl = zmalloc(current->sz); memcpy(node->zl, current->zl, current->sz); } |