Commit 065e9055 authored by Pieter Noordhuis's avatar Pieter Noordhuis
Browse files

Merge pull request #215 from charliesome/fix-bugs

Fix a couple of bugs uncovered by the Clang static analyzer
parents cc3ee453 070da216
...@@ -174,6 +174,11 @@ redisAsyncContext *redisAsyncConnectUnix(const char *path) { ...@@ -174,6 +174,11 @@ redisAsyncContext *redisAsyncConnectUnix(const char *path) {
return NULL; return NULL;
ac = redisAsyncInitialize(c); ac = redisAsyncInitialize(c);
if (ac == NULL) {
redisFree(c);
return NULL;
}
__redisAsyncCopyError(ac); __redisAsyncCopyError(ac);
return ac; return ac;
} }
......
...@@ -295,7 +295,11 @@ sds *sdssplitlen(char *s, int len, char *sep, int seplen, int *count) { ...@@ -295,7 +295,11 @@ sds *sdssplitlen(char *s, int len, char *sep, int seplen, int *count) {
#ifdef SDS_ABORT_ON_OOM #ifdef SDS_ABORT_ON_OOM
if (tokens == NULL) sdsOomAbort(); if (tokens == NULL) sdsOomAbort();
#endif #endif
if (seplen < 1 || len < 0 || tokens == NULL) return NULL; if (tokens == NULL) return NULL;
if (seplen < 1 || len < 0) {
free(tokens);
return NULL;
}
if (len == 0) { if (len == 0) {
*count = 0; *count = 0;
return tokens; return tokens;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment