[sr-dev] git:master:074eda76: erlang: fix memory leaks

Seudin Kasumovic seudin.kasumovic at gmail.com
Wed Jan 3 23:25:26 CET 2018


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

Author: Seudin Kasumovic <seudin.kasumovic at gmail.com>
Committer: Seudin Kasumovic <seudin.kasumovic at gmail.com>
Date: 2018-01-03T23:21:41+01:00

erlang: fix memory leaks

Ensure free used memory if parse of params failed.

---

Modified: src/modules/erlang/erlang_mod.c

---

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

---

diff --git a/src/modules/erlang/erlang_mod.c b/src/modules/erlang/erlang_mod.c
index 2753842967..1c3c12efeb 100644
--- a/src/modules/erlang/erlang_mod.c
+++ b/src/modules/erlang/erlang_mod.c
@@ -666,6 +666,7 @@ static int fixup_rpc(void** param, int param_no)
 	if(param_no==1 || param_no==2) {
 		if (fix_param_types(FPARAM_STR|FPARAM_STRING|FPARAM_AVP|FPARAM_PVS|FPARAM_PVE,param)){
 			LM_ERR("wrong parameter #%d\n",param_no);
+			pkg_free((void*)erl_param);
 			return -1;
 		}
 		erl_param->type = ERL_PARAM_FPARAM;
@@ -873,6 +874,7 @@ static int fixup_reg(void** param, int param_no)
 	if(param_no==1) {
 		if (fix_param_types(FPARAM_STR|FPARAM_STRING|FPARAM_AVP|FPARAM_PVS|FPARAM_PVE|FPARAM_INT,param)){
 			LM_ERR("wrong parameter #%d\n",param_no);
+			pkg_free((void*)erl_param);
 			return -1;
 		}
 		erl_param->type = ERL_PARAM_FPARAM;




More information about the sr-dev mailing list