htable: fix a possible null pointer dereference in dmq startup error case
authorHenning Westerholt <hw@skalatan.de>
Fri, 31 May 2019 10:42:21 +0000 (12:42 +0200)
committerHenning Westerholt <hw@skalatan.de>
Fri, 31 May 2019 10:42:21 +0000 (12:42 +0200)
src/modules/htable/ht_dmq.c

index 1f27e97..26c6eb8 100644 (file)
@@ -588,11 +588,11 @@ int ht_dmq_handle_sync(srjson_doc_t* jdoc) {
                        if(ht==NULL) {
                                LM_WARN("unable to get table %.*s\n",
                                                htname.len, (htname.s)?htname.s:"");
-                       }
-
-                       if (ht_set_cell_ex(ht, &cname, type, &val, 0, expire - now) < 0) {
-                               LM_WARN("unable to set cell %.*s in table %.*s\n",
-                                               cname.len, cname.s, ht->name.len, ht->name.s);
+                       } else {
+                               if (ht_set_cell_ex(ht, &cname, type, &val, 0, expire - now) < 0) {
+                                       LM_WARN("unable to set cell %.*s in table %.*s\n",
+                                                       cname.len, cname.s, ht->name.len, ht->name.s);
+                               }
                        }
                }