int mpm_ret;
SigIntId id = 0;
- ctx->map = SCCalloc(1, ctx->max_sig_id * sizeof(AppLayerProtoDetectPMSignature *));
+ ctx->map = SCCalloc(ctx->max_sig_id, sizeof(AppLayerProtoDetectPMSignature *));
if (ctx->map == NULL)
goto error;
de_ctx->sig_array_len = DetectEngineGetMaxSigId(de_ctx);
de_ctx->sig_array_size = (de_ctx->sig_array_len * sizeof(Signature *));
- de_ctx->sig_array = (Signature **)SCCalloc(1, de_ctx->sig_array_size);
+ de_ctx->sig_array = (Signature **)SCCalloc(de_ctx->sig_array_len, sizeof(Signature *));
if (de_ctx->sig_array == NULL)
goto error;
BUG_ON(sgh->init->match_array != NULL);
- sgh->init->match_array = SCCalloc(1, sgh->init->sig_cnt * sizeof(Signature *));
+ sgh->init->match_array = SCCalloc(sgh->init->sig_cnt, sizeof(Signature *));
if (sgh->init->match_array == NULL)
return -1;
}
if (non_pf > 0) {
- sgh->non_pf_other_store_array = SCCalloc(1, non_pf * sizeof(SignatureNonPrefilterStore));
+ sgh->non_pf_other_store_array = SCCalloc(non_pf, sizeof(SignatureNonPrefilterStore));
BUG_ON(sgh->non_pf_other_store_array == NULL);
}
if (non_pf_syn > 0) {
- sgh->non_pf_syn_store_array = SCCalloc(1, non_pf_syn * sizeof(SignatureNonPrefilterStore));
+ sgh->non_pf_syn_store_array = SCCalloc(non_pf_syn, sizeof(SignatureNonPrefilterStore));
BUG_ON(sgh->non_pf_syn_store_array == NULL);
}
{
if (de_ctx->keyword_id > 0) {
// coverity[suspicious_sizeof : FALSE]
- det_ctx->keyword_ctxs_array = SCCalloc(1, de_ctx->keyword_id * sizeof(void *));
+ det_ctx->keyword_ctxs_array = SCCalloc(de_ctx->keyword_id, sizeof(void *));
if (det_ctx->keyword_ctxs_array == NULL) {
SCLogError("setting up thread local detect ctx");
return TM_ECODE_FAILED;
/* DeState */
if (de_ctx->sig_array_len > 0) {
det_ctx->match_array_len = de_ctx->sig_array_len;
- det_ctx->match_array = SCCalloc(1, det_ctx->match_array_len * sizeof(Signature *));
+ det_ctx->match_array = SCCalloc(det_ctx->match_array_len, sizeof(Signature *));
if (det_ctx->match_array == NULL) {
return TM_ECODE_FAILED;
}
bf->Hash = Hash;
/* setup the bitarray */
- bf->array = SCCalloc(1, bf->array_size * bf->type);
+ bf->array = SCCalloc(bf->array_size, bf->type);
if (bf->array == NULL)
goto error;
ht->Compare = HashTableDefaultCompare;
/* setup the bitarray */
- ht->array = SCCalloc(1, ht->array_size * sizeof(HashTableBucket *));
+ ht->array = SCCalloc(ht->array_size, sizeof(HashTableBucket *));
if (ht->array == NULL)
goto error;
ht->Compare = HashListTableDefaultCompare;
/* setup the bitarray */
- ht->array = SCCalloc(1, ht->array_size * sizeof(HashListTableBucket *));
+ ht->array = SCCalloc(ht->array_size, sizeof(HashListTableBucket *));
if (ht->array == NULL) {
sc_errno = SC_ENOMEM;
goto error;
/* allot space for the failure table. A failure entry in the table for
* every state(SCACBSCtx->state_count) */
- ctx->failure_table = SCCalloc(1, ctx->state_count * sizeof(int32_t));
+ ctx->failure_table = SCCalloc(ctx->state_count, sizeof(int32_t));
if (ctx->failure_table == NULL) {
FatalError("Error allocating memory");
}
/* buffer to hold pointers in the buffer, so that a state can use it
* directly to access its state data */
- ctx->state_table_mod_pointers = SCCalloc(1, ctx->state_count * sizeof(uint8_t *));
+ ctx->state_table_mod_pointers = SCCalloc(ctx->state_count, sizeof(uint8_t *));
if (ctx->state_table_mod_pointers == NULL) {
FatalError("Error allocating memory");
}
/* buffer to hold pointers in the buffer, so that a state can use it
* directly to access its state data */
- ctx->state_table_mod_pointers = SCCalloc(1, ctx->state_count * sizeof(uint8_t *));
+ ctx->state_table_mod_pointers = SCCalloc(ctx->state_count, sizeof(uint8_t *));
if (ctx->state_table_mod_pointers == NULL) {
FatalError("Error allocating memory");
}
}
/* alloc the pattern array */
- ctx->parray = (MpmPattern **)SCCalloc(1, mpm_ctx->pattern_cnt * sizeof(MpmPattern *));
+ ctx->parray = (MpmPattern **)SCCalloc(mpm_ctx->pattern_cnt, sizeof(MpmPattern *));
if (ctx->parray == NULL)
goto error;
mpm_ctx->memory_cnt++;
ctx->single_state_size = sizeof(int32_t) * 256;
/* handle no case patterns */
- ctx->pid_pat_list = SCCalloc(1, (mpm_ctx->max_pat_id + 1) * sizeof(SCACBSPatternList));
+ ctx->pid_pat_list = SCCalloc((mpm_ctx->max_pat_id + 1), sizeof(SCACBSPatternList));
if (ctx->pid_pat_list == NULL) {
FatalError("Error allocating memory");
}
mpm_ctx->memory_size += sizeof(SCACBSCtx);
/* initialize the hash we use to speed up pattern insertions */
- mpm_ctx->init_hash = SCCalloc(1, sizeof(MpmPattern *) * MPM_INIT_HASH_SIZE);
+ mpm_ctx->init_hash = SCCalloc(MPM_INIT_HASH_SIZE, sizeof(MpmPattern *));
if (mpm_ctx->init_hash == NULL) {
exit(EXIT_FAILURE);
}
/* Allocate space for the failure table. A failure entry in the table for
* every state(SCACTileCtx->state_count) */
- ctx->failure_table = SCCalloc(1, ctx->state_count * sizeof(int32_t));
+ ctx->failure_table = SCCalloc(ctx->state_count, sizeof(int32_t));
if (ctx->failure_table == NULL) {
FatalError("Error allocating memory");
}
}
/* alloc the pattern array */
- ctx->parray = (MpmPattern **)SCCalloc(1, mpm_ctx->pattern_cnt * sizeof(MpmPattern *));
+ ctx->parray = (MpmPattern **)SCCalloc(mpm_ctx->pattern_cnt, sizeof(MpmPattern *));
if (ctx->parray == NULL)
goto error;
mpm_ctx->memory_size += sizeof(SCACTileCtx);
/* initialize the hash we use to speed up pattern insertions */
- mpm_ctx->init_hash = SCCalloc(1, sizeof(MpmPattern *) * MPM_INIT_HASH_SIZE);
+ mpm_ctx->init_hash = SCCalloc(MPM_INIT_HASH_SIZE, sizeof(MpmPattern *));
if (mpm_ctx->init_hash == NULL) {
exit(EXIT_FAILURE);
}
/* allot space for the failure table. A failure entry in the table for
* every state(SCACCtx->state_count) */
- ctx->failure_table = SCCalloc(1, ctx->state_count * sizeof(int32_t));
+ ctx->failure_table = SCCalloc(ctx->state_count, sizeof(int32_t));
if (ctx->failure_table == NULL) {
FatalError("Error allocating memory");
}
}
/* alloc the pattern array */
- ctx->parray = (MpmPattern **)SCCalloc(1, mpm_ctx->pattern_cnt * sizeof(MpmPattern *));
+ ctx->parray = (MpmPattern **)SCCalloc(mpm_ctx->pattern_cnt, sizeof(MpmPattern *));
if (ctx->parray == NULL)
goto error;
mpm_ctx->memory_cnt++;
ctx->single_state_size = sizeof(int32_t) * 256;
/* handle no case patterns */
- ctx->pid_pat_list = SCCalloc(1, (mpm_ctx->max_pat_id + 1) * sizeof(SCACPatternList));
+ ctx->pid_pat_list = SCCalloc((mpm_ctx->max_pat_id + 1), sizeof(SCACPatternList));
if (ctx->pid_pat_list == NULL) {
FatalError("Error allocating memory");
}
mpm_ctx->memory_size += sizeof(SCACCtx);
/* initialize the hash we use to speed up pattern insertions */
- mpm_ctx->init_hash = SCCalloc(1, sizeof(MpmPattern *) * MPM_INIT_HASH_SIZE);
+ mpm_ctx->init_hash = SCCalloc(MPM_INIT_HASH_SIZE, sizeof(MpmPattern *));
if (mpm_ctx->init_hash == NULL) {
exit(EXIT_FAILURE);
}
static SCHSCompileData *SCHSAllocCompileData(unsigned int pattern_cnt)
{
- SCHSCompileData *cd = SCCalloc(1, pattern_cnt * sizeof(SCHSCompileData));
+ SCHSCompileData *cd = SCCalloc(pattern_cnt, sizeof(SCHSCompileData));
if (cd == NULL) {
goto error;
}
cd->pattern_cnt = pattern_cnt;
- cd->ids = SCCalloc(1, pattern_cnt * sizeof(unsigned int));
+ cd->ids = SCCalloc(pattern_cnt, sizeof(unsigned int));
if (cd->ids == NULL) {
goto error;
}
- cd->flags = SCCalloc(1, pattern_cnt * sizeof(unsigned int));
+ cd->flags = SCCalloc(pattern_cnt, sizeof(unsigned int));
if (cd->flags == NULL) {
goto error;
}
- cd->expressions = SCCalloc(1, pattern_cnt * sizeof(char *));
+ cd->expressions = SCCalloc(pattern_cnt, sizeof(char *));
if (cd->expressions == NULL) {
goto error;
}
- cd->ext = SCCalloc(1, pattern_cnt * sizeof(hs_expr_ext_t *));
+ cd->ext = SCCalloc(pattern_cnt, sizeof(hs_expr_ext_t *));
if (cd->ext == NULL) {
goto error;
}
pd->hs_db = NULL;
/* alloc the pattern array */
- pd->parray = (SCHSPattern **)SCCalloc(1, pd->pattern_cnt * sizeof(SCHSPattern *));
+ pd->parray = (SCHSPattern **)SCCalloc(pd->pattern_cnt, sizeof(SCHSPattern *));
if (pd->parray == NULL) {
SCFree(pd);
return NULL;
/* initialize the hash we use to speed up pattern insertions */
SCHSCtx *ctx = (SCHSCtx *)mpm_ctx->ctx;
- ctx->init_hash = SCCalloc(1, sizeof(SCHSPattern *) * INIT_HASH_SIZE);
+ ctx->init_hash = SCCalloc(INIT_HASH_SIZE, sizeof(SCHSPattern *));
if (ctx->init_hash == NULL) {
exit(EXIT_FAILURE);
}
if (ctx == NULL)
return;
- SCProfileKeywordData *a = SCCalloc(1, sizeof(SCProfileKeywordData) * DETECT_TBLSIZE);
+ SCProfileKeywordData *a = SCCalloc(DETECT_TBLSIZE, sizeof(SCProfileKeywordData));
if (a != NULL) {
det_ctx->keyword_perf_data = a;
}
int i;
for (i = 0; i < nlists; i++) {
- SCProfileKeywordData *b = SCCalloc(1, sizeof(SCProfileKeywordData) * DETECT_TBLSIZE);
+ SCProfileKeywordData *b = SCCalloc(DETECT_TBLSIZE, sizeof(SCProfileKeywordData));
if (b != NULL) {
det_ctx->keyword_perf_data_per_list[i] = b;
}
de_ctx->profile_keyword_ctx = SCProfilingKeywordInitCtx();
BUG_ON(de_ctx->profile_keyword_ctx == NULL);
- de_ctx->profile_keyword_ctx->data = SCCalloc(1, sizeof(SCProfileKeywordData) * DETECT_TBLSIZE);
+ de_ctx->profile_keyword_ctx->data = SCCalloc(DETECT_TBLSIZE, sizeof(SCProfileKeywordData));
BUG_ON(de_ctx->profile_keyword_ctx->data == NULL);
de_ctx->profile_keyword_ctx_per_list = SCCalloc(nlists, sizeof(SCProfileKeywordDetectCtx *));
de_ctx->profile_keyword_ctx_per_list[i] = SCProfilingKeywordInitCtx();
BUG_ON(de_ctx->profile_keyword_ctx_per_list[i] == NULL);
de_ctx->profile_keyword_ctx_per_list[i]->data =
- SCCalloc(1, sizeof(SCProfileKeywordData) * DETECT_TBLSIZE);
+ SCCalloc(DETECT_TBLSIZE, sizeof(SCProfileKeywordData));
BUG_ON(de_ctx->profile_keyword_ctx_per_list[i]->data == NULL);
}
if (ctx == NULL|| ctx->size == 0)
return;
- SCProfileData *a = SCCalloc(1, sizeof(SCProfileData) * ctx->size);
+ SCProfileData *a = SCCalloc(ctx->size, sizeof(SCProfileData));
if (a != NULL) {
det_ctx->rule_perf_data = a;
det_ctx->rule_perf_data_size = ctx->size;
}
if (count > 0) {
- de_ctx->profile_ctx->data = SCCalloc(1, sizeof(SCProfileData) * de_ctx->profile_ctx->size);
+ de_ctx->profile_ctx->data = SCCalloc(de_ctx->profile_ctx->size, sizeof(SCProfileData));
BUG_ON(de_ctx->profile_ctx->data == NULL);
sig = de_ctx->sig_list;
if (count == 0)
return 0;
- storage_map = SCCalloc(1, sizeof(StorageMapping *) * STORAGE_MAX);
+ storage_map = SCCalloc(STORAGE_MAX, sizeof(StorageMapping *));
if (unlikely(storage_map == NULL)) {
return -1;
}
for (i = 0; i < STORAGE_MAX; i++) {
if (storage_max_id[i] > 0) {
- storage_map[i] = SCCalloc(1, sizeof(StorageMapping) * storage_max_id[i]);
+ storage_map[i] = SCCalloc(storage_max_id[i], sizeof(StorageMapping));
if (storage_map[i] == NULL)
return -1;
}
Storage *store = *storage;
if (store == NULL) {
// coverity[suspicious_sizeof : FALSE]
- store = SCCalloc(1, sizeof(void *) * storage_max_id[type]);
+ store = SCCalloc(storage_max_id[type], sizeof(void *));
if (unlikely(store == NULL))
return NULL;
}