]> 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>
Tue, 30 Oct 2018 09:21:34 +0000 (10:21 +0100)
src/util-mpm.c

index 0dfe1793ba6da07998b718d84a0646081115f1de..12e9f0f32ccea5a0df0ab0ca05beadc83ddce782 100644 (file)
@@ -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++;