[sr-dev] git:master:9a8974a8: htable: check if entries are initialized before sync'ing to db

Daniel-Constantin Mierla miconda at gmail.com
Wed Apr 13 17:05:58 CEST 2022


Module: kamailio
Branch: master
Commit: 9a8974a80b8ce5ffc9166e81f43f8581777cd48f
URL: https://github.com/kamailio/kamailio/commit/9a8974a80b8ce5ffc9166e81f43f8581777cd48f

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-04-13T17:05:18+02:00

htable: check if entries are initialized before sync'ing to db

---

Modified: src/modules/htable/ht_db.c

---

Diff:  https://github.com/kamailio/kamailio/commit/9a8974a80b8ce5ffc9166e81f43f8581777cd48f.diff
Patch: https://github.com/kamailio/kamailio/commit/9a8974a80b8ce5ffc9166e81f43f8581777cd48f.patch

---

diff --git a/src/modules/htable/ht_db.c b/src/modules/htable/ht_db.c
index 5b9a5942ed..cbce085f6c 100644
--- a/src/modules/htable/ht_db.c
+++ b/src/modules/htable/ht_db.c
@@ -551,6 +551,11 @@ int ht_db_save_table(ht_t *ht, str *dbtable)
 	time_t now;
 	int ncols;
 
+	if(ht==NULL || ht->entries==NULL) {
+		LM_DBG("hash table not initialized yet\n");
+		return -1;
+	}
+
 	if(ht_db_con==NULL)
 	{
 		LM_ERR("no db connection\n");




More information about the sr-dev mailing list