Release existing list expression including variables after creating the
prefix string.
Fixes: 96c909ef46f0 ("src: allow for variables in the log prefix string")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
if (len == NF_LOG_PREFIXLEN)
return stmt_error(ctx, stmt, "log prefix is too long");
+ expr = constant_expr_alloc(&stmt->log.prefix->location, &string_type,
+ BYTEORDER_HOST_ENDIAN,
+ strlen(prefix) * BITS_PER_BYTE, prefix);
expr_free(stmt->log.prefix);
+ stmt->log.prefix = expr;
- stmt->log.prefix =
- constant_expr_alloc(&stmt->log.prefix->location, &string_type,
- BYTEORDER_HOST_ENDIAN,
- strlen(prefix) * BITS_PER_BYTE,
- prefix);
return 0;
}