]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
mpm/hs: fix minor coverity warning 3331/head
authorVictor Julien <victor@inliniac.net>
Tue, 3 Apr 2018 10:10:46 +0000 (12:10 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 3 Apr 2018 15:44:57 +0000 (17:44 +0200)
CID 1428797 (#1 of 1): Unchecked return value (CHECKED_RETURN)
    check_return: Calling HashTableAdd without checking return value
    (as is done elsewhere 5 out of 6 times).

src/util-mpm-hs.c

index 295e2552fa0e48e3ca1fc844fcd77ac61a722441..364ebc6b636b159faf7a493fc59af9ca335f3c78 100644 (file)
@@ -716,8 +716,10 @@ int SCHSPreparePatterns(MpmCtx *mpm_ctx)
 
     /* Cache this database globally for later. */
     pd->ref_cnt = 1;
-    HashTableAdd(g_db_table, pd, 1);
+    int r = HashTableAdd(g_db_table, pd, 1);
     SCMutexUnlock(&g_db_table_mutex);
+    if (r < 0)
+        goto error;
 
     SCHSFreeCompileData(cd);
     return 0;