From: Jeff Lucovsky Date: Fri, 21 Jan 2022 14:45:56 +0000 (-0500) Subject: detect/content: Use SCCalloc instead of malloc/memset X-Git-Tag: suricata-7.0.0-rc1~378 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=115297c01686d460531097e5d644536e75e4a2ea;p=thirdparty%2Fsuricata.git detect/content: Use SCCalloc instead of malloc/memset This commit replaces a SCMalloc/memset with SCCalloc --- diff --git a/src/detect-content.c b/src/detect-content.c index e3dbd85379..fa9e078dc6 100644 --- a/src/detect-content.c +++ b/src/detect-content.c @@ -220,14 +220,12 @@ DetectContentData *DetectContentParse(SpmGlobalThreadCtx *spm_global_thread_ctx, return NULL; } - cd = SCMalloc(sizeof(DetectContentData) + len); + cd = SCCalloc(1, sizeof(DetectContentData) + len); if (unlikely(cd == NULL)) { SCFree(content); exit(EXIT_FAILURE); } - memset(cd, 0, sizeof(DetectContentData) + len); - cd->content = (uint8_t *)cd + sizeof(DetectContentData); memcpy(cd->content, content, len); cd->content_len = len;