[sr-dev] git:master:507c3c6f: htable: added function to free $sht(...) pv name

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 21 11:06:42 CET 2017


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-11-21T11:02:11+01:00

htable: added function to free $sht(...) pv name

---

Modified: src/modules/htable/ht_var.c

---

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

---

diff --git a/src/modules/htable/ht_var.c b/src/modules/htable/ht_var.c
index 9ef26a9e7e..0d07b92f19 100644
--- a/src/modules/htable/ht_var.c
+++ b/src/modules/htable/ht_var.c
@@ -129,6 +129,23 @@ int pv_set_ht_cell(struct sip_msg* msg, pv_param_t *param,
 	return 0;
 }
 
+void pv_ht_free_name(void *p)
+{
+	pv_name_t *pn;
+	ht_pv_t *hpv=NULL;
+
+	if(p==NULL)
+		return;
+
+	pn = (pv_name_t*)p;
+	hpv = (ht_pv_t*)pn->u.dname;
+	if(hpv==NULL)
+		return;
+	if(hpv->pve)
+		pv_elem_free_all(hpv->pve);
+	pkg_free(hpv);
+}
+
 int pv_parse_ht_name(pv_spec_p sp, str *in)
 {
 	ht_pv_t *hpv=NULL;
@@ -184,6 +201,7 @@ int pv_parse_ht_name(pv_spec_p sp, str *in)
 	hpv->ht = ht_get_table(&hpv->htname);
 	sp->pvp.pvn.u.dname = (void*)hpv;
 	sp->pvp.pvn.type = PV_NAME_OTHER;
+	sp->pvp.pvn.nfree = pv_ht_free_name;
 	return 0;
 
 error:




More information about the sr-dev mailing list