]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/http2: call correct free function on errors
authorJason Ish <jason.ish@oisf.net>
Mon, 20 Oct 2025 00:36:27 +0000 (18:36 -0600)
committerVictor Julien <vjulien@oisf.net>
Thu, 30 Oct 2025 03:18:39 +0000 (03:18 +0000)
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

index f0fcab6b4fb102fa09937266350d5cfecd33b4e9..b37cc867725a1c041293f3012e5824976d163efa 100644 (file)
@@ -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;
     }