summaryrefslogtreecommitdiffstats
path: root/conf.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-22 08:19:54 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-22 08:19:54 +0000
commit32723ecf1e7bd8a4502cea9c1c8e9ba089b4f0a2 (patch)
tree848c513089d54fc28bdeba4786fed6ed3b760153 /conf.c
parent55b9b1299669b7e66d0a6d06a0709192bd414240 (diff)
downloadrsyslog-32723ecf1e7bd8a4502cea9c1c8e9ba089b4f0a2.tar.gz
rsyslog-32723ecf1e7bd8a4502cea9c1c8e9ba089b4f0a2.tar.xz
rsyslog-32723ecf1e7bd8a4502cea9c1c8e9ba089b4f0a2.zip
fixed bug in duplicate module load detection
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/conf.c b/conf.c
index 56ceb686..56ba3837 100644
--- a/conf.c
+++ b/conf.c
@@ -215,6 +215,7 @@ doModLoad(uchar **pp, __attribute__((unused)) void* pVal)
uchar szPath[512];
uchar errMsg[1024];
uchar *pModName, *pModNameBase;
+ uchar *pModNameDup;
void *pModHdlr, *pModInit;
modInfo_t *pModInfo;
@@ -241,16 +242,20 @@ doModLoad(uchar **pp, __attribute__((unused)) void* pVal)
dbgprintf("Requested to load module '%s'\n", szName);
- pModNameBase = (uchar *) basename(strdup((char *) pModName));
+ if((pModNameDup = (uchar *) strdup((char *) pModName)) == NULL)
+ ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
+
+ pModNameBase = (uchar *) basename((char*)pModNameDup);
pModInfo = modGetNxt(NULL);
while(pModInfo != NULL) {
if(!strcmp((char *) pModNameBase, (char *) modGetName(pModInfo))) {
dbgprintf("Module '%s' already loaded\n", szName);
+ free(pModNameDup);
ABORT_FINALIZE(RS_RET_OK);
}
pModInfo = modGetNxt(pModInfo);
}
- free(pModNameBase);
+ free(pModNameDup);
if(*pModName == '/') {
*szPath = '\0'; /* we do not need to append the path - its already in the module name */
@@ -641,7 +646,6 @@ static rsRetVal cflineProcessTradPRIFilter(uchar **pline, register selector_t *f
}
if (pri < 0) {
-dbgPrintAllDebugInfo();
snprintf((char*) xbuf, sizeof(xbuf), "unknown priority name \"%s\"", buf);
logerror((char*) xbuf);
return RS_RET_ERR;