Date: Tue, 14 Dec 2021 11:02:56 GMT From: Mariusz Zaborski <oshogbo@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 88910b8b7b14 - main - cap_net: plug memory leak Message-ID: <202112141102.1BEB2uf3039742@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=88910b8b7b14386e05bccda0317ace2bfd383ef5 commit 88910b8b7b14386e05bccda0317ace2bfd383ef5 Author: Mariusz Zaborski <oshogbo@FreeBSD.org> AuthorDate: 2021-12-14 10:57:36 +0000 Commit: Mariusz Zaborski <oshogbo@FreeBSD.org> CommitDate: 2021-12-14 11:02:40 +0000 cap_net: plug memory leak MFC after: 5 days --- lib/libcasper/services/cap_net/cap_net.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/libcasper/services/cap_net/cap_net.c b/lib/libcasper/services/cap_net/cap_net.c index 1d5531676268..5e10714e3614 100644 --- a/lib/libcasper/services/cap_net/cap_net.c +++ b/lib/libcasper/services/cap_net/cap_net.c @@ -326,8 +326,10 @@ cap_getaddrinfo(cap_channel_t *chan, const char *hostname, const char *servname, break; nvlai = nvlist_get_nvlist(nvl, nvlname); curai = addrinfo_unpack(nvlai); - if (curai == NULL) + if (curai == NULL) { + nvlist_destroy(nvl); return (EAI_MEMORY); + } if (prevai != NULL) prevai->ai_next = curai; else @@ -896,8 +898,10 @@ net_getnameinfo(const nvlist_t *limits, const nvlist_t *nvlin, nvlist_t *nvlout) error = EAI_FAIL; goto out; } - if (!net_allowed_bsaddr(funclimit, sabin, sabinsize)) - return (ENOTCAPABLE); + if (!net_allowed_bsaddr(funclimit, sabin, sabinsize)) { + error = ENOTCAPABLE; + goto out; + } memcpy(&sast, sabin, sabinsize); salen = (socklen_t)sabinsize;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202112141102.1BEB2uf3039742>