]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/nfs: do not free a null pointer 11684/head
authorPhilippe Antoine <pantoine@oisf.net>
Sun, 23 Jun 2024 20:57:11 +0000 (22:57 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 30 Aug 2024 13:23:14 +0000 (15:23 +0200)
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=69840
(cherry picked from commit b34d4b131425e628b19058b8d2917b2ba9085727)

src/detect-nfs-procedure.c

index 08d69f7d6371a9a7112488c6f8b97323f1e401b4..979f8ae0dc7756e291ec69ccfb55d791d3bea36b 100644 (file)
@@ -163,25 +163,22 @@ static int DetectNfsProcedureSetup (DetectEngineCtx *de_ctx, Signature *s,
     dd = DetectNfsProcedureParse(rawstr);
     if (dd == NULL) {
         SCLogError("Parsing \'%s\' failed", rawstr);
-        goto error;
+        return -1;
     }
 
     /* okay so far so good, lets get this into a SigMatch
      * and put it in the Signature. */
     sm = SigMatchAlloc();
-    if (sm == NULL)
-        goto error;
-
+    if (sm == NULL) {
+        DetectNfsProcedureFree(de_ctx, dd);
+        return -1;
+    }
     sm->type = DETECT_AL_NFS_PROCEDURE;
     sm->ctx = (void *)dd;
 
     SCLogDebug("low %u hi %u", dd->arg1, dd->arg2);
     SigMatchAppendSMToList(s, sm, g_nfs_request_buffer_id);
     return 0;
-
-error:
-    DetectNfsProcedureFree(de_ctx, dd);
-    return -1;
 }
 
 /**