From: Patrick McHardy Date: Fri, 20 Mar 2009 15:17:51 +0000 (+0100) Subject: Fix multiple references to the same user defined symbolic expression X-Git-Tag: v0.099~195 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0e217b46129e6f39fe38354c6682d839f4c8ae34;p=thirdparty%2Fnftables.git Fix multiple references to the same user defined symbolic expression 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 --- diff --git a/src/evaluate.c b/src/evaluate.c index 706ec2e5..cf3ff7f7 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -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) {