From 6149c2145cea26ff09cd98c492800f7c28720940 Mon Sep 17 00:00:00 2001 From: Jeff Lucovsky Date: Fri, 21 Jan 2022 09:45:56 -0500 Subject: [PATCH] detect/content: Use SCCalloc instead of malloc/memset This commit replaces a SCMalloc/memset with SCCalloc --- src/detect-content.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/detect-content.c b/src/detect-content.c index 63de3607b06d..ed7b239c447e 100644 --- a/src/detect-content.c +++ b/src/detect-content.c @@ -213,14 +213,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;