detect/content: Use SCCalloc instead of malloc/memset

This commit replaces a SCMalloc/memset with SCCalloc
pull/8165/head
Jeff Lucovsky 3 years ago committed by Victor Julien
parent 7eb5fb1826
commit 115297c016

@ -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;

Loading…
Cancel
Save