diff options
author | Michael Biebl <biebl@debian.org> | 2008-03-29 12:14:33 +0100 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2008-03-29 12:14:33 +0100 |
commit | db2b679ef6aa0ac3d4679ad3e00a72993204ea78 (patch) | |
tree | 0f95fbe227c3276e051ac79a921045c533b06dda /parse.c | |
parent | 2bff2e5d72345617f3b3e394ff28823067024f7a (diff) | |
download | rsyslog-db2b679ef6aa0ac3d4679ad3e00a72993204ea78.tar.gz |
Imported Upstream version 1.19.7upstream/1.19.7
Diffstat (limited to 'parse.c')
-rw-r--r-- | parse.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -361,8 +361,8 @@ rsRetVal parsQuotedCStr(rsParsObj *pThis, rsCStrObj **ppCStr) #ifdef SYSLOG_INET rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits) { - register unsigned char *pC; - unsigned char *pszIP; + register uchar *pC; + uchar *pszIP; uchar *pszTmp; struct addrinfo hints, *res = NULL; rsCStrObj *pCStr; @@ -373,7 +373,7 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits) assert(pBits != NULL); if((pCStr = rsCStrConstruct()) == NULL) - return RS_RET_OUT_OF_MEMORY; + ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); parsSkipWhitespace(pThis); pC = rsCStrGetBufBeg(pThis->pCStr) + pThis->iCurrPos; @@ -400,11 +400,9 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits) /* now we have the string and must check/convert it to * an NetAddr structure. */ - if((pszIP = rsCStrConvSzStrAndDestruct(pCStr)) == NULL) - return RS_RET_ERR; + CHKiRet(rsCStrConvSzStrAndDestruct(pCStr, &pszIP, 0)); - *pIP = malloc (sizeof (struct NetAddr)); - memset (*pIP, 0, sizeof (struct NetAddr)); + *pIP = calloc(1, sizeof(struct NetAddr)); if (*((char*)pszIP) == '[') { pszTmp = (uchar*)strchr ((char*)pszIP, ']'); @@ -493,7 +491,10 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits) ++pC; } - return RS_RET_OK; + iRet = RS_RET_OK; + +finalize_it: + return iRet; } #endif /* #ifdef SYSLOG_INET */ |