summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-23 13:07:30 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-23 13:07:30 +0000
commit8f236abd49739c0f791c5b893433f7dfa40d3dd8 (patch)
tree03f0811bf92e1fded5b85976864523d1c0b05e7c /parse.c
parente1acf47244aa6ac6d8151f81bc19cf2fe5ce362d (diff)
downloadrsyslog-8f236abd49739c0f791c5b893433f7dfa40d3dd8.tar.gz
rsyslog-8f236abd49739c0f791c5b893433f7dfa40d3dd8.tar.xz
rsyslog-8f236abd49739c0f791c5b893433f7dfa40d3dd8.zip
fixed a memory leak in config file parsing thanks to varmojfekoj for the
patch
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/parse.c b/parse.c
index dddb1b94..efa7f531 100644
--- a/parse.c
+++ b/parse.c
@@ -42,7 +42,7 @@ rsRetVal rsParsDestruct(rsParsObj *pThis)
rsCHECKVALIDOBJECT(pThis, OIDrsPars);
if(pThis->pCStr != NULL)
- RSFREEOBJ(pThis->pCStr);
+ rsCStrDestruct (pThis->pCStr);
RSFREEOBJ(pThis);
return RS_RET_OK;
}
@@ -86,7 +86,7 @@ rsRetVal rsParsConstructFromSz(rsParsObj **ppThis, unsigned char *psz)
/* create parser */
if((iRet = rsParsConstruct(&pThis)) != RS_RET_OK) {
- RSFREEOBJ(pCS);
+ rsCStrDestruct (pCS);
return(iRet);
}
@@ -242,7 +242,7 @@ rsRetVal parsDelimCStr(rsParsObj *pThis, rsCStrObj **ppCStr, char cDelim, int bT
while(pThis->iCurrPos < rsCStrLen(pThis->pCStr)
&& *pC != cDelim) {
if((iRet = rsCStrAppendChar(pCStr, *pC)) != RS_RET_OK) {
- RSFREEOBJ(pCStr);
+ rsCStrDestruct (pCStr);
return(iRet);
}
++pThis->iCurrPos;
@@ -257,14 +257,14 @@ rsRetVal parsDelimCStr(rsParsObj *pThis, rsCStrObj **ppCStr, char cDelim, int bT
* remove anything at its end.
*/
if((iRet = rsCStrFinish(pCStr)) != RS_RET_OK) {
- RSFREEOBJ(pCStr);
+ rsCStrDestruct (pCStr);
return(iRet);
}
if(bTrimTrailing) {
if((iRet = rsCStrTrimTrailingWhiteSpace(pCStr))
!= RS_RET_OK) {
- RSFREEOBJ(pCStr);
+ rsCStrDestruct (pCStr);
return iRet;
}
}
@@ -317,13 +317,13 @@ rsRetVal parsQuotedCStr(rsParsObj *pThis, rsCStrObj **ppCStr)
* we might later introduce other things, like \007!
*/
if((iRet = rsCStrAppendChar(pCStr, *pC)) != RS_RET_OK) {
- RSFREEOBJ(pCStr);
+ rsCStrDestruct (pCStr);
return(iRet);
}
}
} else { /* regular character */
if((iRet = rsCStrAppendChar(pCStr, *pC)) != RS_RET_OK) {
- RSFREEOBJ(pCStr);
+ rsCStrDestruct (pCStr);
return(iRet);
}
}
@@ -335,13 +335,13 @@ rsRetVal parsQuotedCStr(rsParsObj *pThis, rsCStrObj **ppCStr)
++pThis->iCurrPos; /* 'eat' trailing quote */
} else {
/* error - improperly quoted string! */
- RSFREEOBJ(pCStr);
+ rsCStrDestruct (pCStr);
return RS_RET_MISSING_TRAIL_QUOTE;
}
/* We got the string, let's finish it... */
if((iRet = rsCStrFinish(pCStr)) != RS_RET_OK) {
- RSFREEOBJ(pCStr);
+ rsCStrDestruct (pCStr);
return(iRet);
}
@@ -384,7 +384,7 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits)
while(pThis->iCurrPos < rsCStrLen(pThis->pCStr)
&& *pC != '/' && *pC != ',' && !isspace((int)*pC)) {
if((iRet = rsCStrAppendChar(pCStr, *pC)) != RS_RET_OK) {
- RSFREEOBJ(pCStr);
+ rsCStrDestruct (pCStr);
return(iRet);
}
++pThis->iCurrPos;
@@ -393,7 +393,7 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits)
/* We got the string, let's finish it... */
if((iRet = rsCStrFinish(pCStr)) != RS_RET_OK) {
- RSFREEOBJ(pCStr);
+ rsCStrDestruct (pCStr);
return(iRet);
}