From ce9c7a024efe74656e7b054a5fb93718901ae7f3 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Sat, 11 Oct 2025 07:40:50 +0200 Subject: [PATCH] detect/content: don't leak replace memory Replace keyword updates a prior content with a heap allocation of the pattern the content should be replaced with. Make sure this is freed as well. Bug: #7997. --- src/detect-content.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/detect-content.c b/src/detect-content.c index 9e841af054..d0be107daf 100644 --- a/src/detect-content.c +++ b/src/detect-content.c @@ -379,6 +379,8 @@ void DetectContentFree(DetectEngineCtx *de_ctx, void *ptr) if (cd == NULL) SCReturn; + if (cd->replace) + SCFree(cd->replace); SpmDestroyCtx(cd->spm_ctx); SCFree(cd);