diff options
-rw-r--r-- | msg.c | 8 | ||||
-rw-r--r-- | syslogd.c | 14 | ||||
-rw-r--r-- | template.c | 17 |
3 files changed, 33 insertions, 6 deletions
@@ -126,6 +126,14 @@ void MsgDestruct(msg_t * pM) free(pM->pszTIMESTAMP_MySQL); if(pM->pszPRI != NULL) free(pM->pszPRI); + if(pM->pCSProgName != NULL) + rsCStrDestruct(pM->pCSProgName); + if(pM->pCSStrucData != NULL) + rsCStrDestruct(pM->pCSStrucData); + if(pM->pCSPROCID != NULL) + rsCStrDestruct(pM->pCSPROCID); + if(pM->pCSMSGID != NULL) + rsCStrDestruct(pM->pCSMSGID); free(pM); } MsgUnlock(); @@ -1844,6 +1844,18 @@ static rsRetVal selectorDestruct(void *pVal) assert(pThis != NULL); + if(pThis->pCSHostnameComp != NULL) + rsCStrDestruct(pThis->pCSHostnameComp); + if(pThis->pCSProgNameComp != NULL) + rsCStrDestruct(pThis->pCSProgNameComp); + + if(pThis->f_filter_type == FILTER_PROP) { + if(pThis->f_filterData.prop.pCSPropName != NULL) + rsCStrDestruct(pThis->f_filterData.prop.pCSPropName); + if(pThis->f_filterData.prop.pCSCompValue != NULL) + rsCStrDestruct(pThis->f_filterData.prop.pCSCompValue); + } + llDestroy(&pThis->llActList); free(pThis); @@ -4807,7 +4819,6 @@ static rsRetVal cflineProcessHostSelector(uchar **pline) if(pDfltHostnameCmp != NULL) { if((iRet = rsCStrSetSzStr(pDfltHostnameCmp, NULL)) != RS_RET_OK) return(iRet); - pDfltHostnameCmp = NULL; } } else { dbgprintf("setting BSD-like hostname filter to '%s'\n", *pline); @@ -4852,7 +4863,6 @@ static rsRetVal cflineProcessTagSelector(uchar **pline) if(pDfltProgNameCmp != NULL) { if((iRet = rsCStrSetSzStr(pDfltProgNameCmp, NULL)) != RS_RET_OK) return(iRet); - pDfltProgNameCmp = NULL; } } else { dbgprintf("setting programname filter to '%s'\n", *pline); @@ -108,7 +108,11 @@ uchar *tplToString(struct template *pTpl, msg_t *pMsg) * "real" (usable) string and discard the helper structures. */ rsCStrFinish(pCStr); - return rsCStrConvSzStrAndDestruct(pCStr); + if((pVal = rsCStrConvSzStrAndDestruct(pCStr)) == NULL) { + pVal = malloc(1); + *pVal = '\0'; + } + return pVal; } /* Helper to doSQLEscape. This is called if doSQLEscape @@ -293,7 +297,7 @@ struct template* tplConstruct(void) */ static int do_Constant(unsigned char **pp, struct template *pTpl) { - register unsigned char *p; + register unsigned char *p, *s; rsCStrObj *pStrB; struct templateEntry *pTpe; int i; @@ -373,8 +377,13 @@ static int do_Constant(unsigned char **pp, struct template *pTpl) * benefit from the counted string object. * 2005-09-09 rgerhards */ - pTpe->data.constant.iLenConstant = rsCStrLen(pStrB); - pTpe->data.constant.pConstant = (char*) rsCStrConvSzStrAndDestruct(pStrB); + if ((pTpe->data.constant.iLenConstant = rsCStrLen(pStrB)) == 0) { + s = malloc(1); + *s = '\0'; + rsCStrDestruct(pStrB); + } else + s = rsCStrConvSzStrAndDestruct(pStrB); + pTpe->data.constant.pConstant = (char*) s; *pp = p; |