X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/8e33831b2b93d6d0a324ca01c6934197887276d8..3ea204e1031a94dafca7f7e4eed2f79ec3bd7fd0:/src/sds.c diff --git a/src/sds.c b/src/sds.c index da049f6c..67e2d456 100644 --- a/src/sds.c +++ b/src/sds.c @@ -305,7 +305,10 @@ sds *sdssplitlen(char *s, int len, char *sep, int seplen, int *count) { #ifdef SDS_ABORT_ON_OOM if (tokens == NULL) sdsOomAbort(); #endif - if (seplen < 1 || len < 0 || tokens == NULL) return NULL; + if (seplen < 1 || len < 0 || tokens == NULL) { + *count = 0; + return NULL; + } if (len == 0) { *count = 0; return tokens; @@ -360,6 +363,7 @@ cleanup: int i; for (i = 0; i < elements; i++) sdsfree(tokens[i]); zfree(tokens); + *count = 0; return NULL; } #endif