From nobody Tue Dec 14 11:02:56 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 65D6E18DB0C1; Tue, 14 Dec 2021 11:02:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JCwTF152mz3Lf6; Tue, 14 Dec 2021 11:02:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0529426974; Tue, 14 Dec 2021 11:02:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BEB2uIG039743; Tue, 14 Dec 2021 11:02:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BEB2uf3039742; Tue, 14 Dec 2021 11:02:56 GMT (envelope-from git) Date: Tue, 14 Dec 2021 11:02:56 GMT Message-Id: <202112141102.1BEB2uf3039742@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 88910b8b7b14 - main - cap_net: plug memory leak List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88910b8b7b14386e05bccda0317ace2bfd383ef5 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639479777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OgQ+Of4ddeLw7zstXR6Nz1o2H04qyHhes30mdl0qD7M=; b=J0Bv6lJ94zPp7YOAdk7PZY6quwE9o65bXEMW+8G01TN3cL1QaA/R2YS/bNhuE6pwgf/1Mj do5KOngH0D/IXWdq29vlIzpgPL3WDvTGxNKTca/47E0OGIUQwjYJMZCv8EDTK8imI50Y1m 583rdXsAUJhCeq7BH9KRWG1Ss7kk/Am2dHiVqGIHs7BFc8LNZeiFJ71HsgE4AvEG9JuMk4 7Nvdl98LXstsYg0PGsXkdJAxMV8QwIr5uOtY837zwpcCm3UxCo4gALx7HAtPtnlo1i8ks+ RThe02Of5YNUSt3pap36ucCBvkoHcGye1Zpwyczz2E3J97vhnhd2MFGrClfaMQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639479777; a=rsa-sha256; cv=none; b=W2zj3ZcJrGKgQ3NsZefulnPEbJ3+HPN2rmjvFWaRQAs935ODk5qsULvq3zi2e+9JzExamQ Db7omqLrPLIzlTBnIPDltFU86FP0zcAFkRJFxmFonSk3Ky9gP5vYPfWtUFeGFBSYILmsJR PmV5kdo1mF4NbCAwI0W5dGr8t0umSq9pocdCuKVa/dGwwezYVoXHBa6wa7j1XyWufnV8BJ B1m2Jz6w8sjAE3AS9+ahqOI2fMSe0fwIFSVOeCfW3RqUTYuoloyhQjz143+5pS4mH+mhVe joPgIUHwi1g5njEFlgMdSO3p2hGdmR84utHV25MEtFUVpDqcGbEzALt7mdq7uQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=88910b8b7b14386e05bccda0317ace2bfd383ef5 commit 88910b8b7b14386e05bccda0317ace2bfd383ef5 Author: Mariusz Zaborski AuthorDate: 2021-12-14 10:57:36 +0000 Commit: Mariusz Zaborski 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;