From 7b547c7cd65c42f7ea49308c1783ac85fe0e050f Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Sun, 23 Jun 2024 22:57:11 +0200 Subject: [PATCH] detect/nfs: do not free a null pointer https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=69840 (cherry picked from commit b34d4b131425e628b19058b8d2917b2ba9085727) --- src/detect-nfs-procedure.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/detect-nfs-procedure.c b/src/detect-nfs-procedure.c index 08d69f7d63..979f8ae0dc 100644 --- a/src/detect-nfs-procedure.c +++ b/src/detect-nfs-procedure.c @@ -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; } /** -- 2.47.2