diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-09-17 08:51:26 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-09-17 08:51:26 +0200 |
commit | 0569f2e581529d893cd471f6c33bce13a53e0542 (patch) | |
tree | 6c1670e1b65489f29e95f507e3e0161f332622c4 | |
parent | 32269e3727df81896a1d349842f651ed887121f1 (diff) | |
download | rsyslog-0569f2e581529d893cd471f6c33bce13a53e0542.tar.gz rsyslog-0569f2e581529d893cd471f6c33bce13a53e0542.tar.bz2 rsyslog-0569f2e581529d893cd471f6c33bce13a53e0542.zip |
bugfix: small memory leaks in template() statements
these were one-time memory leaks during startup, so they did NOT grow
during runtime
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | template.c | 12 |
2 files changed, 12 insertions, 3 deletions
@@ -17,6 +17,9 @@ Version 6.5.1 [devel] 2012-08-?? used \x as escape where x was any character (e.g. "\n" meant "n" and NOT LF). This also means there is some incompatibility to v5 for well-know sequences. Better break it now than later. +- bugfix: small memory leaks in template() statements + these were one-time memory leaks during startup, so they did NOT grow + during runtime --------------------------------------------------------------------------- Version 6.5.0 [devel] 2012-08-28 - imrelp now supports non-cancel thread termination @@ -1240,7 +1240,7 @@ createConstantTpe(struct template *pTpl, struct cnfobj *o) struct templateEntry *pTpe; es_str_t *value; int i; - struct cnfparamvals *pvals; + struct cnfparamvals *pvals = NULL; uchar *outname = NULL; DEFiRet; @@ -1274,6 +1274,8 @@ createConstantTpe(struct template *pTpl, struct cnfobj *o) pTpe->data.constant.pConstant = (uchar*)es_str2cstr(value, NULL); finalize_it: + if(pvals != NULL) + cnfparamvalsDestruct(pvals, &pblkConstant); RETiRet; } @@ -1294,7 +1296,7 @@ createPropertyTpe(struct template *pTpl, struct cnfobj *o) int re_matchToUse = 0; int re_submatchToUse = 0; char *re_expr = NULL; - struct cnfparamvals *pvals; + struct cnfparamvals *pvals = NULL; enum {F_NONE, F_CSV, F_JSON, F_JSONF} formatType = F_NONE; enum {CC_NONE, CC_ESCAPE, CC_SPACE, CC_DROP} controlchr = CC_NONE; enum {SP_NONE, SP_DROP, SP_REPLACE} secpath = SP_NONE; @@ -1563,6 +1565,8 @@ createPropertyTpe(struct template *pTpl, struct cnfobj *o) } finalize_it: + if(pvals != NULL) + cnfparamvalsDestruct(pvals, &pblkProperty); RETiRet; } @@ -1599,7 +1603,7 @@ rsRetVal tplProcessCnf(struct cnfobj *o) { struct template *pTpl = NULL; - struct cnfparamvals *pvals; + struct cnfparamvals *pvals = NULL; int lenName; char *name = NULL; uchar *tplStr = NULL; @@ -1746,6 +1750,8 @@ tplProcessCnf(struct cnfobj *o) pTpl->optFormatEscape = JSON_ESCAPE; finalize_it: + if(pvals != NULL) + cnfparamvalsDestruct(pvals, &pblk); if(iRet != RS_RET_OK) { if(pTpl != NULL) { /* we simply make the template defunct in this case by setting |