[sr-dev] git:master:d542cb89: htable: reset entries field if hash table initialization fails

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


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-04-13T12:52:15+02:00

htable: reset entries field if hash table initialization fails

---

Modified: src/modules/htable/ht_api.c

---

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

---

diff --git a/src/modules/htable/ht_api.c b/src/modules/htable/ht_api.c
index daf088d1f8..00023e7153 100644
--- a/src/modules/htable/ht_api.c
+++ b/src/modules/htable/ht_api.c
@@ -395,7 +395,6 @@ int ht_init_tables(void)
 		if(ht->entries==NULL)
 		{
 			LM_ERR("no more shared memory for [%.*s]\n", ht->name.len, ht->name.s);
-			shm_free(ht);
 			return -1;
 		}
 		memset(ht->entries, 0, ht->htsize*sizeof(ht_entry_t));
@@ -413,7 +412,7 @@ int ht_init_tables(void)
 					i--;
 				}
 				shm_free(ht->entries);
-				shm_free(ht);
+				ht->entries = NULL;
 				return -1;
 
 			}




More information about the sr-dev mailing list