mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
sds.c no longe pre-allocate more than 1MB of free space ahead. This fixes issue #252.
This commit is contained in:
parent
7faa1f075b
commit
bd068b15c2
@ -116,7 +116,11 @@ sds sdsMakeRoomFor(sds s, size_t addlen) {
|
||||
if (free >= addlen) return s;
|
||||
len = sdslen(s);
|
||||
sh = (void*) (s-(sizeof(struct sdshdr)));
|
||||
newlen = (len+addlen)*2;
|
||||
newlen = (len+addlen);
|
||||
if (newlen < SDS_MAX_PREALLOC)
|
||||
newlen *= 2;
|
||||
else
|
||||
newlen += SDS_MAX_PREALLOC;
|
||||
newsh = zrealloc(sh, sizeof(struct sdshdr)+newlen+1);
|
||||
#ifdef SDS_ABORT_ON_OOM
|
||||
if (newsh == NULL) sdsOomAbort();
|
||||
|
Loading…
Reference in New Issue
Block a user