X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/ed9b544e10b84cd43348ddfab7068b610a5df1f7..f1017b3fb318d8524210ce4d599a0b083036dee9:/sds.c diff --git a/sds.c b/sds.c index ca77a079..8e9fd96d 100644 --- a/sds.c +++ b/sds.c @@ -28,6 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#define SDS_ABORT_ON_OOM + #include "sds.h" #include #include @@ -278,8 +280,10 @@ sds *sdssplitlen(char *s, int len, char *sep, int seplen, int *count) { for (j = 0; j < (len-(seplen-1)); j++) { /* make sure there is room for the next element and the final one */ if (slots < elements+2) { + sds *newtokens; + slots *= 2; - sds *newtokens = zrealloc(tokens,sizeof(sds)*slots); + newtokens = zrealloc(tokens,sizeof(sds)*slots); if (newtokens == NULL) { #ifdef SDS_ABORT_ON_OOM sdsOomAbort();