]> git.saurik.com Git - redis.git/commitdiff
Fixed a tiny memory leak when loading the configuration file.
authorAlex McHale <alexmchale@gmail.com>
Tue, 13 Apr 2010 16:48:33 +0000 (11:48 -0500)
committerAlex McHale <alexmchale@gmail.com>
Tue, 13 Apr 2010 16:48:33 +0000 (11:48 -0500)
redis.c

diff --git a/redis.c b/redis.c
index e78f75aa637c9aa4a0bf3502d539acc17af4e157..bb54cce02062b714b302d2c689561227cc1a65ba 100644 (file)
--- a/redis.c
+++ b/redis.c
@@ -1693,15 +1693,12 @@ static void loadServerConfig(char *filename) {
     char buf[REDIS_CONFIGLINE_MAX+1], *err = NULL;
     int linenum = 0;
     sds line = NULL;
-    char *errormsg = "Fatal error, can't open config file '%s'";
-    char *errorbuf = zmalloc(sizeof(char)*(strlen(errormsg)+strlen(filename)));
-    sprintf(errorbuf, errormsg, filename);
 
     if (filename[0] == '-' && filename[1] == '\0')
         fp = stdin;
     else {
         if ((fp = fopen(filename,"r")) == NULL) {
-            redisLog(REDIS_WARNING, errorbuf);
+            redisLog(REDIS_WARNING, "Fatal error, can't open config file '%s'", filename);
             exit(1);
         }
     }