]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
mpm: fix minor scan-build warning
authorVictor Julien <victor@inliniac.net>
Thu, 25 Oct 2018 09:55:05 +0000 (11:55 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 1 Nov 2018 14:46:10 +0000 (15:46 +0100)
src/util-mpm.c

index 92fdedd52e46e790c7a82cecf32ece0e3700dd47..2610388a850ea0782c54ac7f39d1cdd5e88092ad 100644 (file)
@@ -600,7 +600,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) {
@@ -699,7 +699,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++;