summaryrefslogtreecommitdiffstats
path: root/tools/omfile.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-06-25 12:35:46 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-06-25 12:35:46 +0200
commitbf85d81790a26945e404c6fdfdddad5eadbaa371 (patch)
tree5b9e97ea2c78e9450f58971ecae3234ba7eb3c85 /tools/omfile.c
parent4b150db338ae885ea3a3bb7cc5b5f84e2fc96e89 (diff)
downloadrsyslog-bf85d81790a26945e404c6fdfdddad5eadbaa371.tar.gz
rsyslog-bf85d81790a26945e404c6fdfdddad5eadbaa371.tar.xz
rsyslog-bf85d81790a26945e404c6fdfdddad5eadbaa371.zip
implemented freeCnf() module interface & fixed some mem leaks
The interface was actually not present in older versions, even though some modules already used it. The implementation was now done, and not in 6.3/6.4 because the resulting memory leak was ultra-slim and the new interface handling has some potential to seriously break things. Not the kind of thing you want to add in late beta state, if avoidable.
Diffstat (limited to 'tools/omfile.c')
-rw-r--r--tools/omfile.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/omfile.c b/tools/omfile.c
index e9f4cba8..446e1b32 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -182,7 +182,6 @@ uchar *pszFileDfltTplName; /* name of the default template to use */
struct modConfData_s {
rsconf_t *pConf; /* our overall config object */
- struct cnfparamvals* vals; /* vals kept to detect re-set options */
uchar *tplName; /* default template */
};
@@ -292,6 +291,7 @@ setLegacyDfltTpl(void __attribute__((unused)) *pVal, uchar* newVal)
DEFiRet;
if(loadModConf != NULL && loadModConf->tplName != NULL) {
+ free(newVal);
errmsg.LogError(0, RS_RET_ERR, "omfile default template already set via module "
"global parameter - can no longer be changed");
ABORT_FINALIZE(RS_RET_ERR);
@@ -754,16 +754,15 @@ CODESTARTbeginCnfLoad
ENDbeginCnfLoad
BEGINsetModCnf
- struct cnfparamvals *pvals;
+ struct cnfparamvals *pvals = NULL;
int i;
CODESTARTsetModCnf
- loadModConf->vals = nvlstGetParams(lst, &modpblk, loadModConf->vals);
- if(loadModConf->vals == NULL) {
+ pvals = nvlstGetParams(lst, &modpblk, NULL);
+ if(pvals == NULL) {
errmsg.LogError(0, RS_RET_MISSING_CNFPARAMS, "error processing module "
"config parameters [module(...)]");
ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS);
}
- pvals = loadModConf->vals;
if(Debug) {
dbgprintf("module (global) param blk for omfile:\n");
@@ -786,6 +785,8 @@ CODESTARTsetModCnf
}
}
finalize_it:
+ if(pvals != NULL)
+ cnfparamvalsDestruct(pvals, &modpblk);
ENDsetModCnf
BEGINendCnfLoad
@@ -809,6 +810,7 @@ ENDactivateCnf
BEGINfreeCnf
CODESTARTfreeCnf
+ free(pModConf->tplName);
ENDfreeCnf