Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/ziplist.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,11 @@ unsigned char *ziplistNew(void) {

/* Resize the ziplist. */
unsigned char *ziplistResize(unsigned char *zl, unsigned int len) {
zl = zrealloc(zl,len);
unsigned char* znew = zmalloc(len);
size_t old_size = zmalloc_size(zl);
(len > old_size) ? memcpy(znew, zl, old_size) : memcpy(znew, zl, len);
zfree(zl);
zl = znew;
ZIPLIST_BYTES(zl) = intrev32ifbe(len);
zl[len-1] = ZIP_END;
return zl;
Expand Down