Skip to content

Commit

Permalink
Fix potential error when generating INFO string
Browse files Browse the repository at this point in the history
Clang (scan-build) flags this as an error, but it can't
happen under normal usage because the input is verified
in caller function.  Clang doesn't trust the caller
to always pass correct input though, so it gets registered
as an error in the report.

It's better to remove the possibility of a crash, even if
only technically.  It also makes our error report cleaner
since we know this isn't a problem.
  • Loading branch information
mattsta committed Aug 6, 2014
1 parent 8349dc6 commit 09b619a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/redis.c
Expand Up @@ -2574,6 +2574,9 @@ sds genRedisInfoString(char *section) {
allsections = strcasecmp(section,"all") == 0;
defsections = strcasecmp(section,"default") == 0;
serversections = strcasecmp(section,"server") == 0;
} else {
/* If !section, the strcasecmp() calls below will die. */
return sdsempty();
}

getrusage(RUSAGE_SELF, &self_ru);
Expand Down

0 comments on commit 09b619a

Please sign in to comment.