summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-12-16 12:02:36 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-12-16 12:02:36 +0100
commit7817aa1597384fce7ac643e56ee56f47d3c5d37d (patch)
tree3084fe8a0368f3a4602c49c287fa339b7c3daa28 /runtime
parentc4026ec0f8d843540d01b07f94d4182d7dddb62e (diff)
downloadrsyslog-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 'runtime')
-rw-r--r--runtime/conf.c7
-rw-r--r--runtime/ctok.c2
2 files changed, 7 insertions, 2 deletions
diff --git a/runtime/conf.c b/runtime/conf.c
index d41f2950..529142ed 100644
--- a/runtime/conf.c
+++ b/runtime/conf.c
@@ -1084,7 +1084,7 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction)
DEFiRet;
modInfo_t *pMod;
omodStringRequest_t *pOMSR;
- action_t *pAction;
+ action_t *pAction = NULL;
void *pModData;
ASSERT(p != NULL);
@@ -1092,6 +1092,11 @@ static rsRetVal cflineDoAction(uchar **p, action_t **ppAction)
/* loop through all modules and see if one picks up the line */
pMod = module.GetNxtType(NULL, eMOD_OUT);
+ /* Note: clang static analyzer reports that pMod mybe == NULL. However, this is
+ * not possible, because we have the built-in output modules which are always
+ * present. Anyhow, we guard this by an assert. -- rgerhards, 2010-12-16
+ */
+ assert(pMod != NULL);
while(pMod != NULL) {
pOMSR = NULL;
iRet = pMod->mod.om.parseSelectorAct(p, &pModData, &pOMSR);
diff --git a/runtime/ctok.c b/runtime/ctok.c
index 18ddaed2..a17d0ec9 100644
--- a/runtime/ctok.c
+++ b/runtime/ctok.c
@@ -267,7 +267,7 @@ ctokGetVar(ctok_t *pThis, ctok_token_t *pToken)
{
DEFiRet;
uchar c;
- cstr_t *pstrVal;
+ cstr_t *pstrVal = NULL;
ISOBJ_TYPE_assert(pThis, ctok);
ASSERT(pToken != NULL);