[sr-dev] git:4.1: htable: use pkg for temporary hash table slots used for reload

Daniel-Constantin Mierla miconda at gmail.com
Mon Jan 6 22:55:37 CET 2014


Module: sip-router
Branch: 4.1
Commit: 75e904f2c2034075383b412e2dcb18c6fb01c7c3
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=75e904f2c2034075383b412e2dcb18c6fb01c7c3

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Thu Jan  2 13:22:28 2014 +0100

htable: use pkg for temporary hash table slots used for reload

- free the temporary slots after reload, reported in FS#385

(cherry picked from commit 53689b55632c6208e6326f1a5f4b3c45da216f43)

---

 modules/htable/htable.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/modules/htable/htable.c b/modules/htable/htable.c
index 1900ec5..6345b9e 100644
--- a/modules/htable/htable.c
+++ b/modules/htable/htable.c
@@ -490,7 +490,7 @@ static struct mi_root* ht_mi_reload(struct mi_root* cmd_tree, void* param)
 		return init_mi_tree( 500, "no such hash table", 18);
 	}
 	memcpy(&nht, ht, sizeof(ht_t));
-	nht.entries = (ht_entry_t*)shm_malloc(nht.htsize*sizeof(ht_entry_t));
+	nht.entries = (ht_entry_t*)pkg_malloc(nht.htsize*sizeof(ht_entry_t));
 	if(nht.entries == NULL)
 	{
 		ht_db_close_con();
@@ -525,6 +525,7 @@ static struct mi_root* ht_mi_reload(struct mi_root* cmd_tree, void* param)
 			ht_cell_free(it);
 		}
 	}
+	pkg_free(nht.entries);
 	ht_db_close_con();
 	return init_mi_tree( 200, MI_OK_S, MI_OK_LEN);
 }




More information about the sr-dev mailing list