fix bugs of memory leak

This commit is contained in:
linmujia 2015-11-27 10:04:08 +08:00
parent 248f3ed8f4
commit 6de1a8cf7f

12
parse.c
View File

@ -453,6 +453,12 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits)
/* mask bits follow, let's parse them! */
++pThis->iCurrPos; /* eat slash */
if((iRet = parsInt(pThis, pBits)) != RS_RET_OK) {
if((*pIP)->addr.NetAddr != NULL) {
free((*pIP)->addr.NetAddr);
}
if((*pIP)->addr.HostWildcard != NULL) {
free((*pIP)->addr.HostWildcard);
}
free (pszIP);
free (*pIP);
FINALIZE;
@ -489,6 +495,12 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits)
/* mask bits follow, let's parse them! */
++pThis->iCurrPos; /* eat slash */
if((iRet = parsInt(pThis, pBits)) != RS_RET_OK) {
if((*pIP)->addr.NetAddr != NULL) {
free((*pIP)->addr.NetAddr);
}
if((*pIP)->addr.HostWildcard != NULL) {
free((*pIP)->addr.HostWildcard);
}
free (pszIP);
free (*pIP);
FINALIZE;