]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't add conf pairs to sections twice. (#3955)
authorNick Porter <nick@portercomputing.co.uk>
Tue, 23 Feb 2021 16:30:44 +0000 (16:30 +0000)
committerGitHub <noreply@github.com>
Tue, 23 Feb 2021 16:30:44 +0000 (16:30 +0000)
src/lib/server/cf_util.c

index 221a764506d5a1b14773e5a2a846f971bfee6021..897898e37b631eb78eaf38ee789437f755ae8a52 100644 (file)
@@ -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;
 }