mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-19 18:30:42 +01:00
fix bugs of memory leak
This commit is contained in:
parent
248f3ed8f4
commit
6de1a8cf7f
12
parse.c
12
parse.c
@ -453,6 +453,12 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits)
|
|||||||
/* mask bits follow, let's parse them! */
|
/* mask bits follow, let's parse them! */
|
||||||
++pThis->iCurrPos; /* eat slash */
|
++pThis->iCurrPos; /* eat slash */
|
||||||
if((iRet = parsInt(pThis, pBits)) != RS_RET_OK) {
|
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 (pszIP);
|
||||||
free (*pIP);
|
free (*pIP);
|
||||||
FINALIZE;
|
FINALIZE;
|
||||||
@ -489,6 +495,12 @@ rsRetVal parsAddrWithBits(rsParsObj *pThis, struct NetAddr **pIP, int *pBits)
|
|||||||
/* mask bits follow, let's parse them! */
|
/* mask bits follow, let's parse them! */
|
||||||
++pThis->iCurrPos; /* eat slash */
|
++pThis->iCurrPos; /* eat slash */
|
||||||
if((iRet = parsInt(pThis, pBits)) != RS_RET_OK) {
|
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 (pszIP);
|
||||||
free (*pIP);
|
free (*pIP);
|
||||||
FINALIZE;
|
FINALIZE;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user