mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
fix minor memory leak in rewriteConfigSds (#9762)
This commit is contained in:
parent
c22d3684ba
commit
cd0f710be9
@ -1066,7 +1066,7 @@ void rewriteConfigStringOption(struct rewriteConfigState *state, const char *opt
|
||||
}
|
||||
|
||||
/* Rewrite a SDS string option. */
|
||||
void rewriteConfigSdsOption(struct rewriteConfigState *state, const char *option, sds value, const sds defvalue) {
|
||||
void rewriteConfigSdsOption(struct rewriteConfigState *state, const char *option, sds value, const char *defvalue) {
|
||||
int force = 1;
|
||||
sds line;
|
||||
|
||||
@ -1078,7 +1078,7 @@ void rewriteConfigSdsOption(struct rewriteConfigState *state, const char *option
|
||||
}
|
||||
|
||||
/* Set force to zero if the value is set to its default. */
|
||||
if (defvalue && sdscmp(value, defvalue) == 0) force = 0;
|
||||
if (defvalue && strcmp(value, defvalue) == 0) force = 0;
|
||||
|
||||
line = sdsnew(option);
|
||||
line = sdscatlen(line, " ", 1);
|
||||
@ -1634,7 +1634,7 @@ static void sdsConfigGet(client *c, typeData data) {
|
||||
}
|
||||
|
||||
static void sdsConfigRewrite(typeData data, const char *name, struct rewriteConfigState *state) {
|
||||
rewriteConfigSdsOption(state, name, *(data.sds.config), data.sds.default_value ? sdsnew(data.sds.default_value) : NULL);
|
||||
rewriteConfigSdsOption(state, name, *(data.sds.config), data.sds.default_value);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user