Message ID | 20230801093310.594942-2-yoyang@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Double-Free and Memory Leak Found In libtirpc | expand |
diff --git a/src/rpcb_clnt.c b/src/rpcb_clnt.c index d178d86..630f9ad 100644 --- a/src/rpcb_clnt.c +++ b/src/rpcb_clnt.c @@ -252,12 +252,16 @@ delete_cache(addr) for (cptr = front; cptr != NULL; cptr = cptr->ac_next) { if (!memcmp(cptr->ac_taddr->buf, addr->buf, addr->len)) { /* Unlink from cache. We'll destroy it after releasing the mutex. */ - if (cptr->ac_uaddr) + if (cptr->ac_uaddr) { free(cptr->ac_uaddr); - if (prevptr) + cptr->ac_uaddr = NULL; + } + if (prevptr) { prevptr->ac_next = cptr->ac_next; - else + } + else { front = cptr->ac_next; + } cachesize--; break; }
Signed-off-by: Herb Wartens <wartens2@llnl.gov> --- src/rpcb_clnt.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)