git: c664d8dfc3dd - main - cat: Fix potential memory leak

Mariusz Zaborski oshogbo at FreeBSD.org
Fri Jan 15 20:49:49 UTC 2021


The branch main has been updated by oshogbo:

URL: https://cgit.FreeBSD.org/src/commit/?id=c664d8dfc3dd65611f63ca8277841a29a46260f1

commit c664d8dfc3dd65611f63ca8277841a29a46260f1
Author:     Mariusz Zaborski <oshogbo at FreeBSD.org>
AuthorDate: 2021-01-15 20:48:39 +0000
Commit:     Mariusz Zaborski <oshogbo at FreeBSD.org>
CommitDate: 2021-01-15 20:49:52 +0000

    cat: Fix potential memory leak
    
    This was introduced in aefe30c5437159a5399bdbc1974d6fbf40f2ba0f.
---
 bin/cat/cat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bin/cat/cat.c b/bin/cat/cat.c
index 58f7c15cc9cb..cdfc983610de 100644
--- a/bin/cat/cat.c
+++ b/bin/cat/cat.c
@@ -458,6 +458,7 @@ udom_open(const char *path, int flags)
 		}
 		if (caph_rights_limit(fd, &rights) < 0) {
 			close(fd);
+			freeaddrinfo(res0);
 			return (-1);
 		}
 		error = cap_connect(capnet, fd, res->ai_addr, res->ai_addrlen);


More information about the dev-commits-src-main mailing list