summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2018-02-14 16:26:46 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2018-02-15 16:29:32 +0100
commita5112cc040f81806ab76d5fa0a34a2cc34da9b84 (patch)
treeb5333561705e4286d5b5acc711e49d1c710f368b
parent3ddc637cc42cd0a854ea2e7232a855330bfe22e5 (diff)
payload: add payload_dependency_release() helper function
Wrap code that releases existing dependencies that we have just annotated in the context structure. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/payload.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/payload.c b/src/payload.c
index df3c8136..21c28428 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -428,6 +428,17 @@ void payload_dependency_store(struct payload_dep_ctx *ctx,
ctx->pdep = stmt;
}
+static void payload_dependency_release(struct payload_dep_ctx *ctx)
+{
+ list_del(&ctx->pdep->list);
+ stmt_free(ctx->pdep);
+
+ ctx->pbase = PROTO_BASE_INVALID;
+ if (ctx->pdep == ctx->prev)
+ ctx->prev = NULL;
+ ctx->pdep = NULL;
+}
+
/**
* __payload_dependency_kill - kill a redundant payload depedency
*
@@ -442,15 +453,8 @@ void __payload_dependency_kill(struct payload_dep_ctx *ctx,
{
if (ctx->pbase != PROTO_BASE_INVALID &&
ctx->pbase == base &&
- ctx->pdep != NULL) {
- list_del(&ctx->pdep->list);
- stmt_free(ctx->pdep);
-
- ctx->pbase = PROTO_BASE_INVALID;
- if (ctx->pdep == ctx->prev)
- ctx->prev = NULL;
- ctx->pdep = NULL;
- }
+ ctx->pdep != NULL)
+ payload_dependency_release(ctx);
}
void payload_dependency_kill(struct payload_dep_ctx *ctx, struct expr *expr,