From: Nick Porter Date: Tue, 23 Feb 2021 16:30:44 +0000 (+0000) Subject: Don't add conf pairs to sections twice. (#3955) X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e3bf7fc65b8f384568eb4de7b1e6c1f90dc077ce;p=thirdparty%2Ffreeradius-server.git Don't add conf pairs to sections twice. (#3955) --- diff --git a/src/lib/server/cf_util.c b/src/lib/server/cf_util.c index 221a764506d..897898e37b6 100644 --- a/src/lib/server/cf_util.c +++ b/src/lib/server/cf_util.c @@ -1228,8 +1228,6 @@ int cf_pair_replace(CONF_SECTION *cs, CONF_PAIR *cp, char const *value) if (!cs || !cp || !value) return -1; - MEM(new_cp = cf_pair_alloc(cs, cp->attr, value, cp->op, cp->lhs_quote, cp->rhs_quote)); - /* * Remove the old CONF_PAIR */ @@ -1239,7 +1237,7 @@ int cf_pair_replace(CONF_SECTION *cs, CONF_PAIR *cp, char const *value) /* * Add the new CONF_PAIR */ - cf_item_add(cf_section_to_item(cs), cf_pair_to_item(new_cp)); + MEM(new_cp = cf_pair_alloc(cs, cp->attr, value, cp->op, cp->lhs_quote, cp->rhs_quote)); return 0; }