Skip to content

Commit

Permalink
erlang: fix memory leaks
Browse files Browse the repository at this point in the history
Ensure free used memory if parse of params failed.

(cherry picked from commit 074eda7)
  • Loading branch information
seudin committed Jan 4, 2018
1 parent a262553 commit 4d8e075
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/modules/erlang/erlang_mod.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4d8e075

Please sign in to comment.