Module: kamailio
Branch: master
Commit: 711a5600330793b2ca787ce451f2ad48620dd639
URL:
https://github.com/kamailio/kamailio/commit/711a5600330793b2ca787ce451f2ad4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-24T11:38:51+02:00
statistics: free vars in case of error in fixup function
---
Modified: src/modules/statistics/statistics.c
---
Diff:
https://github.com/kamailio/kamailio/commit/711a5600330793b2ca787ce451f2ad4…
Patch:
https://github.com/kamailio/kamailio/commit/711a5600330793b2ca787ce451f2ad4…
---
diff --git a/src/modules/statistics/statistics.c b/src/modules/statistics/statistics.c
index 499b4198ba..c5ace8c185 100644
--- a/src/modules/statistics/statistics.c
+++ b/src/modules/statistics/statistics.c
@@ -135,6 +135,7 @@ static int fixup_stat(void** param, int param_no)
if (s.s[0]=='$') {
if (fixup_pvar_null(param, 1)!=0) {
LM_ERR("invalid pv %s as parameter\n",s.s);
+ pkg_free(sopv);
return E_CFG;
}
sopv->pv = (pv_spec_t*)(*param);
@@ -143,10 +144,10 @@ static int fixup_stat(void** param, int param_no)
sopv->stat = get_stat( &s );
if (sopv->stat==0) {
LM_ERR("variable <%s> not defined\n", s.s);
+ pkg_free(sopv);
return E_CFG;
}
}
- pkg_free(s.s);
*param=(void*)sopv;
return 0;
} else if (param_no==2) {
@@ -160,6 +161,7 @@ static int fixup_stat(void** param, int param_no)
if (s.s[0] == '$') {
if (fixup_pvar_pvar(param, 2) != 0) {
LM_ERR("invalid pv %s as parameter\n",s.s);
+ pkg_free(lopv);
return E_CFG;
}
lopv->pv = (pv_spec_t*) (*param);
@@ -179,13 +181,14 @@ static int fixup_stat(void** param, int param_no)
if (err==0){
if (n==0 && (s.s[0]!='$')) { //we can't check the value of the
pvar so have to ignore this check if it is a pvar
LM_ERR("update with 0 has no sense\n");
+ pkg_free(lopv);
return E_CFG;
}
- pkg_free(s.s);
*param=(void*)lopv;
return 0;
}else{
LM_ERR("bad update number <%s>\n",(char*)(*param));
+ pkg_free(lopv);
return E_CFG;
}
}