mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
Fixed a tiny memory leak when loading the configuration file.
This commit is contained in:
parent
b60bace9f9
commit
9a22de8270
5
redis.c
5
redis.c
@ -1693,15 +1693,12 @@ static void loadServerConfig(char *filename) {
|
|||||||
char buf[REDIS_CONFIGLINE_MAX+1], *err = NULL;
|
char buf[REDIS_CONFIGLINE_MAX+1], *err = NULL;
|
||||||
int linenum = 0;
|
int linenum = 0;
|
||||||
sds line = NULL;
|
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')
|
if (filename[0] == '-' && filename[1] == '\0')
|
||||||
fp = stdin;
|
fp = stdin;
|
||||||
else {
|
else {
|
||||||
if ((fp = fopen(filename,"r")) == NULL) {
|
if ((fp = fopen(filename,"r")) == NULL) {
|
||||||
redisLog(REDIS_WARNING, errorbuf);
|
redisLog(REDIS_WARNING, "Fatal error, can't open config file '%s'", filename);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user