From 65e7e93f88e6267f6bfc1adb0fa1c62ba8840f32 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Sun, 19 Oct 2025 18:36:27 -0600 Subject: [PATCH] detect/http2: call correct free function on errors Fix cases where the wrong free function was being called in error handlers. DetectHTTP2sizeUpdateSetup was calling DetectHTTP2settingsFree instead of DetectHTTP2sizeUpdateFree in error case. Moving http2.priority and http2.window to multi-integers, instead of basic integers only modified the Free callback, but the Setup function was still using the direct call to old obsolete free function. Using the callback Free abstration in Setup, allows to be consistent and have less code to change. --- src/detect-http2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/detect-http2.c b/src/detect-http2.c index f0fcab6b4f..b37cc86772 100644 --- a/src/detect-http2.c +++ b/src/detect-http2.c @@ -345,13 +345,13 @@ static int DetectHTTP2prioritySetup (DetectEngineCtx *de_ctx, Signature *s, cons if (SCDetectSignatureSetAppProto(s, ALPROTO_HTTP2) != 0) return -1; - DetectU8Data *prio = SCDetectU8ArrayParse(str); + void *prio = SCDetectU8ArrayParse(str); if (prio == NULL) return -1; if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_PRIORITY, (SigMatchCtx *)prio, g_http2_match_buffer_id) == NULL) { - SCDetectU8Free(prio); + DetectHTTP2priorityFree(NULL, prio); return -1; } @@ -397,14 +397,14 @@ static int DetectHTTP2windowSetup (DetectEngineCtx *de_ctx, Signature *s, const if (SCDetectSignatureSetAppProto(s, ALPROTO_HTTP2) != 0) return -1; - DetectU32Data *wu = SCDetectU32ArrayParse(str); + void *wu = SCDetectU32ArrayParse(str); if (wu == NULL) return -1; // use g_http2_complete_buffer_id as we may have window changes in any state if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_WINDOW, (SigMatchCtx *)wu, g_http2_complete_buffer_id) == NULL) { - SCDetectU32Free(wu); + DetectHTTP2windowFree(NULL, wu); return -1; } @@ -450,13 +450,13 @@ static int DetectHTTP2sizeUpdateSetup (DetectEngineCtx *de_ctx, Signature *s, co if (SCDetectSignatureSetAppProto(s, ALPROTO_HTTP2) != 0) return -1; - void *su = SCDetectU64Parse(str); + DetectU64Data *su = SCDetectU64Parse(str); if (su == NULL) return -1; if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_HTTP2_SIZEUPDATE, (SigMatchCtx *)su, g_http2_match_buffer_id) == NULL) { - DetectHTTP2settingsFree(NULL, su); + DetectHTTP2sizeUpdateFree(NULL, su); return -1; }