*** CID
1358124: Null pointer dereferences (REVERSE_INULL)
/src/detect-engine-mpm.c: 940 in MpmStoreSetup()
934 PopulateMpmHelperAddPatternToPktCtx(ms->mpm_ctx,
935 cd, s, 0, (cd->flags & DETECT_CONTENT_FAST_PATTERN_CHOP));
936 }
937 }
938 }
939
>>> CID
1358124: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "ms->mpm_ctx" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
940 if (ms->mpm_ctx != NULL) {
941 if (ms->mpm_ctx->pattern_cnt == 0) {
942 MpmFactoryReClaimMpmCtx(de_ctx, ms->mpm_ctx);
943 ms->mpm_ctx = NULL;
944 } else {
945 if (ms->sgh_mpm_context == MPM_CTX_FACTORY_UNIQUE_CONTEXT) {
}
ms->mpm_ctx = MpmFactoryGetMpmCtxForProfile(de_ctx, ms->sgh_mpm_context, dir);
+ if (ms->mpm_ctx == NULL)
+ return;
+
MpmInitCtx(ms->mpm_ctx, de_ctx->mpm_matcher);
/* add the patterns */
}
}
- if (ms->mpm_ctx != NULL) {
- if (ms->mpm_ctx->pattern_cnt == 0) {
- MpmFactoryReClaimMpmCtx(de_ctx, ms->mpm_ctx);
- ms->mpm_ctx = NULL;
- } else {
- if (ms->sgh_mpm_context == MPM_CTX_FACTORY_UNIQUE_CONTEXT) {
- if (mpm_table[ms->mpm_ctx->mpm_type].Prepare != NULL) {
- mpm_table[ms->mpm_ctx->mpm_type].Prepare(ms->mpm_ctx);
- }
+ if (ms->mpm_ctx->pattern_cnt == 0) {
+ MpmFactoryReClaimMpmCtx(de_ctx, ms->mpm_ctx);
+ ms->mpm_ctx = NULL;
+ } else {
+ if (ms->sgh_mpm_context == MPM_CTX_FACTORY_UNIQUE_CONTEXT) {
+ if (mpm_table[ms->mpm_ctx->mpm_type].Prepare != NULL) {
+ mpm_table[ms->mpm_ctx->mpm_type].Prepare(ms->mpm_ctx);
}
}
}