Skip to content

Commit

Permalink
Merge pull request redis#215 from charliesome/fix-bugs
Browse files Browse the repository at this point in the history
Fix a couple of bugs uncovered by the Clang static analyzer
  • Loading branch information
pietern committed Jan 15, 2014
2 parents cc3ee45 + 070da21 commit 065e905
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion async.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ redisAsyncContext *redisAsyncConnectUnix(const char *path) {
return NULL;

ac = redisAsyncInitialize(c);
if (ac == NULL) {
redisFree(c);
return NULL;
}

__redisAsyncCopyError(ac);
return ac;
}
Expand Down Expand Up @@ -398,7 +403,7 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
__redisAsyncDisconnect(ac);
return;
}

/* If monitor mode, repush callback */
if(c->flags & REDIS_MONITORING) {
__redisPushCallback(&ac->replies,&cb);
Expand Down
6 changes: 5 additions & 1 deletion sds.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,11 @@ 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 (tokens == NULL) return NULL;
if (seplen < 1 || len < 0) {
free(tokens);
return NULL;
}
if (len == 0) {
*count = 0;
return tokens;
Expand Down

0 comments on commit 065e905

Please sign in to comment.