[sr-dev] git:5.0:732680dd: erlang: fix memory leaks

Seudin Kasumovic seudin.kasumovic at gmail.com
Thu Jan 4 09:30:54 CET 2018


Module: kamailio
Branch: 5.0
Commit: 732680dd622a115de4dd2a93f5065d22ff5d5896
URL: https://github.com/kamailio/kamailio/commit/732680dd622a115de4dd2a93f5065d22ff5d5896

Author: Seudin Kasumovic <seudin.kasumovic at gmail.com>
Committer: Seudin Kasumovic <seudin.kasumovic at gmail.com>
Date: 2018-01-04T09:26:36+01:00

erlang: fix memory leaks

Ensure free used memory if parse of params failed.

(cherry picked from commit 074eda76b3c2cb418832fd4b24436bf7f109b89e)

---

Modified: src/modules/erlang/erlang_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/732680dd622a115de4dd2a93f5065d22ff5d5896.diff
Patch: https://github.com/kamailio/kamailio/commit/732680dd622a115de4dd2a93f5065d22ff5d5896.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