diff options
Diffstat (limited to 'parse.c')
-rw-r--r-- | parse.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -414,14 +414,16 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits) /* now we have the string and must check/convert it to * an NetAddr structure. */ - CHKiRet(cstrConvSzStrAndDestruct(pCStr, &pszIP, 0)); + CHKiRet(cstrConvSzStrAndDestruct(&pCStr, &pszIP, 0)); - *pIP = calloc(1, sizeof(struct NetAddr)); + if((*pIP = calloc(1, sizeof(struct NetAddr))) == NULL) + ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY); if (*((char*)pszIP) == '[') { pszTmp = (uchar*)strchr ((char*)pszIP, ']'); if (pszTmp == NULL) { free (pszIP); + free (*pIP); ABORT_FINALIZE(RS_RET_INVALID_IP); } *pszTmp = '\0'; |