Module: kamailio
Branch: 5.0
Commit: 447d49f75c69621473fccd0c0fe3b6c4d6679ffc
URL:
https://github.com/kamailio/kamailio/commit/447d49f75c69621473fccd0c0fe3b6c…
Author: Seudin Kasumovic <seudin.kasumovic(a)gmail.com>
Committer: Seudin Kasumovic <seudin.kasumovic(a)gmail.com>
Date: 2018-01-04T23:00:32+01:00
erlang: fix missing to free memory used for param specification
- ensure to destroy fixup param specification when send erlang message
(cherry picked from commit 90ee13d21db9a57a9d4a855b857dd152f645500d)
---
Modified: src/modules/erlang/erlang_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/447d49f75c69621473fccd0c0fe3b6c…
Patch:
https://github.com/kamailio/kamailio/commit/447d49f75c69621473fccd0c0fe3b6c…
---
diff --git a/src/modules/erlang/erlang_mod.c b/src/modules/erlang/erlang_mod.c
index 54d2fa1733..83d007aa68 100644
--- a/src/modules/erlang/erlang_mod.c
+++ b/src/modules/erlang/erlang_mod.c
@@ -697,6 +697,7 @@ static int fixup_rpc(void** param, int param_no)
if (psp->setf != pv_list_set && psp->setf != pv_xbuff_set) {
LM_ERR("wrong parameter #%d: accepted types are list or
xbuff\n",param_no);
+ pv_spec_destroy(&erl_param->value.sp);
pkg_free((void*)erl_param);
return E_UNSPEC;
}
@@ -915,6 +916,7 @@ static int fixup_reg(void** param, int param_no)
erl_param->type = ERL_PARAM_XBUFF_SPEC;
} else {
LM_ERR("wrong parameter #%d\n",param_no);
+ pv_spec_destroy(&erl_param->value.sp);
pkg_free((void*)erl_param);
return E_UNSPEC;
}
@@ -1109,6 +1111,7 @@ static int fixup_reply(void** param, int param_no)
erl_param->type = ERL_PARAM_XBUFF_SPEC;
} else {
LM_ERR("wrong parameter #%d\n",param_no);
+ pv_spec_destroy(&erl_param->value.sp);
pkg_free((void*)erl_param);
return E_UNSPEC;
}
@@ -1354,6 +1357,7 @@ static int fixup_send(void** param, int param_no)
if (erl_param->value.sp.pvp.pvn.type == PV_NAME_INTSTR) {
if (fix_param_types(FPARAM_STR|FPARAM_STRING,param)) {
LM_ERR("wrong parameter #%d\n",param_no);
+ pv_spec_destroy(&erl_param->value.sp);
pkg_free((void*)erl_param);
return E_UNSPEC;
}
@@ -1363,6 +1367,7 @@ static int fixup_send(void** param, int param_no)
else {
if (erl_param->value.sp.type == PVT_XAVP) {
LM_ERR("XAVP not acceptable for parameter #%d\n",param_no);
+ pv_spec_destroy(&erl_param->value.sp);
pkg_free((void*)erl_param);
return E_UNSPEC;
}
@@ -1373,6 +1378,7 @@ static int fixup_send(void** param, int param_no)
erl_param->type = ERL_PARAM_XBUFF_SPEC;
} else {
LM_ERR("wrong parameter #%d\n",param_no);
+ pv_spec_destroy(&erl_param->value.sp);
pkg_free((void*)erl_param);
return E_UNSPEC;
}
@@ -1392,6 +1398,7 @@ static int fixup_send(void** param, int param_no)
if (erl_param->value.sp.pvp.pvn.type == PV_NAME_INTSTR) {
if (fix_param_types(FPARAM_STR|FPARAM_STRING,param)) {
LM_ERR("wrong parameter #%d\n",param_no);
+ pv_spec_destroy(&erl_param->value.sp);
pkg_free((void*)erl_param);
return E_UNSPEC;
}
@@ -1400,6 +1407,7 @@ static int fixup_send(void** param, int param_no)
} else {
if (erl_param->value.sp.type ==PVT_XAVP) {
LM_ERR("XAVP not acceptable for parameter #%d\n",param_no);
+ pv_spec_destroy(&erl_param->value.sp);
pkg_free((void*)erl_param);
return E_UNSPEC;
}
@@ -1415,7 +1423,7 @@ static int fixup_send(void** param, int param_no)
erl_param->type = ERL_PARAM_XBUFF_SPEC;
} else {
LM_ERR("wrong parameter #%d\n",param_no);
- pv_spec_free(&erl_param->value.sp);
+ pv_spec_destroy(&erl_param->value.sp);
pkg_free((void*)erl_param);
return E_UNSPEC;
}