From cd0f710be957191a98620535430c629ba30c7453 Mon Sep 17 00:00:00 2001 From: Jim Brunner Date: Tue, 9 Nov 2021 10:35:22 -0800 Subject: [PATCH] fix minor memory leak in rewriteConfigSds (#9762) --- src/config.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config.c b/src/config.c index 5d0bf664a..6247c363a 100644 --- a/src/config.c +++ b/src/config.c @@ -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); }