diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-12-16 12:02:36 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-12-16 12:02:36 +0100 |
commit | 7817aa1597384fce7ac643e56ee56f47d3c5d37d (patch) | |
tree | 3084fe8a0368f3a4602c49c287fa339b7c3daa28 /template.c | |
parent | c4026ec0f8d843540d01b07f94d4182d7dddb62e (diff) | |
download | rsyslog-7817aa1597384fce7ac643e56ee56f47d3c5d37d.tar.gz rsyslog-7817aa1597384fce7ac643e56ee56f47d3c5d37d.tar.xz rsyslog-7817aa1597384fce7ac643e56ee56f47d3c5d37d.zip |
bugfix: unitialized variable could cause issues under extreme conditions
plus some minor nits. This was found after a clang static code analyzer
analysis (great tool, and special thanks to Marcin for telling me about
it!)
Diffstat (limited to 'template.c')
-rw-r--r-- | template.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -86,9 +86,9 @@ rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar **ppBuf, size_t * DEFiRet; struct templateEntry *pTpe; size_t iBuf; - unsigned short bMustBeFreed; + unsigned short bMustBeFreed = 0; uchar *pVal; - size_t iLenVal; + size_t iLenVal = 0; assert(pTpl != NULL); assert(pMsg != NULL); @@ -1046,7 +1046,6 @@ void tplDeleteAll(void) { struct template *pTpl, *pTplDel; struct templateEntry *pTpe, *pTpeDel; - rsRetVal iRetLocal; BEGINfunc pTpl = tplRoot; @@ -1069,7 +1068,7 @@ void tplDeleteAll(void) case FIELD: /* check if we have a regexp and, if so, delete it */ if(pTpeDel->data.field.has_regex != 0) { - if((iRetLocal = objUse(regexp, LM_REGEXP_FILENAME)) == RS_RET_OK) { + if(objUse(regexp, LM_REGEXP_FILENAME) == RS_RET_OK) { regexp.regfree(&(pTpeDel->data.field.re)); } } @@ -1095,7 +1094,6 @@ void tplDeleteNew(void) { struct template *pTpl, *pTplDel; struct templateEntry *pTpe, *pTpeDel; - rsRetVal iRetLocal; BEGINfunc @@ -1124,7 +1122,7 @@ void tplDeleteNew(void) case FIELD: /* check if we have a regexp and, if so, delete it */ if(pTpeDel->data.field.has_regex != 0) { - if((iRetLocal = objUse(regexp, LM_REGEXP_FILENAME)) == RS_RET_OK) { + if(objUse(regexp, LM_REGEXP_FILENAME) == RS_RET_OK) { regexp.regfree(&(pTpeDel->data.field.re)); } } |