浏览代码

erlang: fix memory leaks

Ensure free used memory if parse of params failed.
Seudin Kasumovic 7 年之前
父节点
当前提交
074eda76b3
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      src/modules/erlang/erlang_mod.c

+ 2 - 0
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;