From e22a833b948a8476d89fc40297404f6e72e830e3 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 25 Oct 2018 11:55:05 +0200 Subject: [PATCH] mpm: fix minor scan-build warning --- src/util-mpm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util-mpm.c b/src/util-mpm.c index 0dfe1793ba..12e9f0f32c 100644 --- a/src/util-mpm.c +++ b/src/util-mpm.c @@ -457,7 +457,7 @@ static inline int MpmInitHashAdd(MpmCtx *ctx, MpmPattern *p) uint32_t hash = MpmInitHash(p); if (ctx->init_hash == NULL) { - return 0; + return -1; } if (ctx->init_hash[hash] == NULL) { @@ -559,7 +559,8 @@ int MpmAddPattern(MpmCtx *mpm_ctx, uint8_t *pat, uint16_t patlen, } /* put in the pattern hash */ - MpmInitHashAdd(mpm_ctx, p); + if (MpmInitHashAdd(mpm_ctx, p) != 0) + goto error; mpm_ctx->pattern_cnt++;