]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
Fix multiple references to the same user defined symbolic expression
authorPatrick McHardy <kaber@trash.net>
Fri, 20 Mar 2009 15:17:51 +0000 (16:17 +0100)
committerPatrick McHardy <kaber@trash.net>
Fri, 20 Mar 2009 15:17:51 +0000 (16:17 +0100)
The expression needs to be cloned so transformations don't corrupt the original
expression. This could be slightly optimized by only taking a reference and
COW'ing when necessary (which is actually quite rare).

Signed-off-by: Patrick McHardy <kaber@trash.net>
src/evaluate.c

index 706ec2e58a38152f9bedd5311e87415c58dbdfda..cf3ff7f7145da2c197e0c4c8de55eec0a02353c0 100644 (file)
@@ -113,8 +113,7 @@ static int expr_evaluate_symbol(struct eval_ctx *ctx, struct expr **expr)
                        return expr_error(ctx, *expr,
                                          "undefined identifier '%s'",
                                          (*expr)->identifier);
-               // FIXME: need to copy (on write)
-               new = expr_get(sym->expr);
+               new = expr_clone(sym->expr);
        } else {
                erec = symbol_parse(*expr, &new);
                if (erec != NULL) {