Signed-off-by: Herb Wartens <wartens2@xxxxxxxx> --- src/rpcb_clnt.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/rpcb_clnt.c b/src/rpcb_clnt.c index 630f9ad..539b521 100644 --- a/src/rpcb_clnt.c +++ b/src/rpcb_clnt.c @@ -102,19 +102,31 @@ static void destroy_addr(addr) struct address_cache *addr; { - if (addr == NULL) + if (addr == NULL) { return; - if(addr->ac_host != NULL) + } + if(addr->ac_host != NULL) { free(addr->ac_host); - if(addr->ac_netid != NULL) + addr->ac_host = NULL; + } + if(addr->ac_netid != NULL) { free(addr->ac_netid); - if(addr->ac_uaddr != NULL) + addr->ac_netid = NULL; + } + if(addr->ac_uaddr != NULL) { free(addr->ac_uaddr); + addr->ac_uaddr = NULL; + } if(addr->ac_taddr != NULL) { - if(addr->ac_taddr->buf != NULL) + if(addr->ac_taddr->buf != NULL) { free(addr->ac_taddr->buf); + addr->ac_taddr->buf = NULL; + } + free(addr->ac_taddr); + addr->ac_taddr = NULL; } free(addr); + addr = NULL; } /* -- 2.31.1