diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-22 08:19:54 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-02-22 08:19:54 +0000 |
commit | 32723ecf1e7bd8a4502cea9c1c8e9ba089b4f0a2 (patch) | |
tree | 848c513089d54fc28bdeba4786fed6ed3b760153 | |
parent | 55b9b1299669b7e66d0a6d06a0709192bd414240 (diff) | |
download | rsyslog-32723ecf1e7bd8a4502cea9c1c8e9ba089b4f0a2.tar.gz rsyslog-32723ecf1e7bd8a4502cea9c1c8e9ba089b4f0a2.tar.xz rsyslog-32723ecf1e7bd8a4502cea9c1c8e9ba089b4f0a2.zip |
fixed bug in duplicate module load detection
-rw-r--r-- | conf.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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; |