Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
9a22de82
Commit
9a22de82
authored
Apr 13, 2010
by
Alex McHale
Browse files
Fixed a tiny memory leak when loading the configuration file.
parent
b60bace9
Changes
1
Show whitespace changes
Inline
Side-by-side
redis.c
View file @
9a22de82
...
@@ -1693,15 +1693,12 @@ static void loadServerConfig(char *filename) {
...
@@ -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);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment