diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-07-21 13:55:45 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-07-21 13:55:45 +0200 |
commit | 63446424c057f527c9c17be7e06f306a130789b4 (patch) | |
tree | f860f85b933793bf49e26f18db33111b493f116e /grammar/rainerscript.c | |
parent | 448f2eeea247fe4bf7bbbc982fb6df0f7a1b72f9 (diff) | |
download | rsyslog-63446424c057f527c9c17be7e06f306a130789b4.tar.gz rsyslog-63446424c057f527c9c17be7e06f306a130789b4.tar.xz rsyslog-63446424c057f527c9c17be7e06f306a130789b4.zip |
fixing minor memory leaks
Diffstat (limited to 'grammar/rainerscript.c')
-rw-r--r-- | grammar/rainerscript.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c index c953c840..0b2ee7cb 100644 --- a/grammar/rainerscript.c +++ b/grammar/rainerscript.c @@ -475,6 +475,7 @@ cnfactlstAddSysline(struct cnfactlst* actlst, char *line) return actlst; } + void cnfactlstDestruct(struct cnfactlst *actlst) { @@ -483,6 +484,7 @@ cnfactlstDestruct(struct cnfactlst *actlst) while(actlst != NULL) { toDel = actlst; actlst = actlst->next; + cnfcfsyslinelstDestruct(toDel->syslines); if(toDel->actType == CNFACT_V2) nvlstDestruct(toDel->data.lst); else @@ -1245,6 +1247,28 @@ cnfrulePrint(struct cnfrule *rule) dbgprintf("------ end rule %p\n", rule); } +void +cnfcfsyslinelstDestruct(struct cnfcfsyslinelst *cfslst) +{ + struct cnfcfsyslinelst *toDel; + while(cfslst != NULL) { + toDel = cfslst; + cfslst = cfslst->next; + free(toDel->line); + free(toDel); + } +} + +void +cnfruleDestruct(struct cnfrule *rule) +{ + if( rule->filttype == CNFFILT_PRI + || rule->filttype == CNFFILT_PROP) + free(rule->filt.s); + cnfactlstDestruct(rule->actlst); + free(rule); +} + struct cnffparamlst * cnffparamlstNew(struct cnfexpr *expr, struct cnffparamlst *next) { @@ -1382,6 +1406,23 @@ cnfDoInclude(char *name) return 0; } +void +varDelete(struct var *v) +{ + if(v->datatype == 'S') + es_deleteStr(v->d.estr); +} + +void +cnfparamvalsDestruct(struct cnfparamvals *paramvals, struct cnfparamblk *blk) +{ + int i; + for(i = 0 ; i < blk->nParams ; ++i) { + varDelete(¶mvals[i].val); + } + free(paramvals); +} + /* find the index (or -1!) for a config param by name. This is used to * address the parameter array. Of course, we could use with static * indices, but that would create some extra bug potential. So we |