From: Philippe Antoine Date: Sun, 23 Jun 2024 20:57:11 +0000 (+0200) Subject: detect/nfs: do not free a null pointer X-Git-Tag: suricata-7.0.7~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b547c7cd65c42f7ea49308c1783ac85fe0e050f;p=thirdparty%2Fsuricata.git detect/nfs: do not free a null pointer https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=69840 (cherry picked from commit b34d4b131425e628b19058b8d2917b2ba9085727) --- 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; } /**