From 534356d1c53c5d83d3ff1c436bc866ed183faef9 Mon Sep 17 00:00:00 2001 From: Kashif Rasul Date: Fri, 4 Apr 2014 10:25:40 +0200 Subject: [PATCH] Fix issues raised by clang analyzer Closes #1660 --- src/redis-cli.c | 1 + src/redis.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/redis-cli.c b/src/redis-cli.c index 3367b9bc0e1f..338bf4be7268 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -644,6 +644,7 @@ static int cliSendCommand(int argc, char **argv, int repeat) { printf("Entering slave output mode... (press Ctrl-C to quit)\n"); slaveMode(); config.slave_mode = 0; + free(argvlen); return REDIS_ERR; /* Error = slaveMode lost connection to master */ } diff --git a/src/redis.c b/src/redis.c index 5ddbc9250d2f..af8ff62667f4 100644 --- a/src/redis.c +++ b/src/redis.c @@ -2559,12 +2559,13 @@ sds genRedisInfoString(char *section) { int j, numcommands; struct rusage self_ru, c_ru; unsigned long lol, bib; - int allsections = 0, defsections = 0; + int allsections = 0, defsections = 0, serversections = 0; int sections = 0; if (section) { allsections = strcasecmp(section,"all") == 0; defsections = strcasecmp(section,"default") == 0; + serversections = strcasecmp(section,"server") == 0; } getrusage(RUSAGE_SELF, &self_ru); @@ -2572,7 +2573,7 @@ sds genRedisInfoString(char *section) { getClientsMaxBuffers(&lol,&bib); /* Server */ - if (allsections || defsections || !strcasecmp(section,"server")) { + if (allsections || defsections || serversections) { static int call_uname = 1; static struct utsname name; char *mode;