From nobody Sat Mar 12 10:29:35 2022 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 1CB4E1A04F95; Sat, 12 Mar 2022 10:29:36 +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 4KFzZ75Yggz4nQL; Sat, 12 Mar 2022 10:29:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647080975; 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=gT81kh0xzK+Pr2u5y1F2gZOpw5yWmfkvoicaf8/hrRQ=; b=LPceqsvqx6mvRtXi0IYfma/aBA5apRUbk0By5KEdEvFcCHI0CnwUJl8VX6LDzegD/+ZxkO Z9p3OUhjn9ZYgQLCBN/8XMJ/NwEJKzg0dbnpoaLLc9XB+/R15efMlhMYwq4rMNEQ+J+OAn WdstzeNACYEcxwNokUrPwp3Nxrk97TuRigxOonbJKp+Uenwzb0wXmhsZa4mwKYQ74u5eSy 8WY8h5aVqBtEuw/Cptqacp8Iv2No3lxKm3shhEdedONUy33d0hRmPy3tK+I9VJR/sqqqti yJ7ZSEFFTc9KbQW0mOD2iUTXqsIgw7D5SvCv00m3b+atOcHMDuFDc5+1VwARMg== 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 65E9F2B701; Sat, 12 Mar 2022 10:29:35 +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 22CATZ3C022654; Sat, 12 Mar 2022 10:29:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22CATZ0U022653; Sat, 12 Mar 2022 10:29:35 GMT (envelope-from git) Date: Sat, 12 Mar 2022 10:29:35 GMT Message-Id: <202203121029.22CATZ0U022653@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mariusz Zaborski Subject: git: 2b0d4ae9ce61 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2b0d4ae9ce617effa72e469e8b0d113d2008bea8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647080975; 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=gT81kh0xzK+Pr2u5y1F2gZOpw5yWmfkvoicaf8/hrRQ=; b=Ec+84ZelTCxFK8ThWJj0KqyqPeQ2St9Ao15Y9Uu2dNiBfcIXFRcWc1QP9dmnciM4nSmZPV Zq1Q+y7IjkWotbzGONln8aZQ6qRNNFG0ZkA3d/nbILV1nvPoak+b9ofoWfW6D4mKXdivB1 2UMgAcP62pcYL8LDK6ROZSiC9G2VX45mMl7OX4x4jT/92okPMG8vbGZYswrQbhLCqhdyx7 AVQ6ItUdayMxdhQId5Nk4ZwXxYeBgJPfE8K+G2TLGiMaGN7AuaCyeWTo3lzOlmsB3F53Q8 tL2ABkB+xWeSjraWGJCjyha4pmbxQNGF7i22qdOUx6KBditSDWXq85hvEcJdZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647080975; a=rsa-sha256; cv=none; b=nSJwvj59tx06sXqb+hMnVSpCRnwhjQcxUP6ag7ZjJk01mcOKZOG4V/NJPDUBVZosn7sRqU SnGrEv8q58f6Saxwi7HTkT7ndtrQhS5aLiFEVQwAUnlTyczHOfOZb5shPAxN5364cu27M3 zPwTiYpca8b/dCJAX6kfIp+o+cIob+/EhsDMXHPAHEhBXezgZje9QhWDVMG4e+Eaux9LNG 4DY6/Yd43L7FQRbmpjobPuPzqQ+2ojbjbS43/oWoKLzO//p0SmEo+W3rKtl7SLT4S5jcqD Y1k7oE8A0HurLZgrNqHJ8I/sN2A+qzKdkFCzjtEm7hcBJ154dCF3wycK8D4fDg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=2b0d4ae9ce617effa72e469e8b0d113d2008bea8 commit 2b0d4ae9ce617effa72e469e8b0d113d2008bea8 Author: Mariusz Zaborski AuthorDate: 2021-12-14 10:57:36 +0000 Commit: Mariusz Zaborski CommitDate: 2022-03-12 10:28:52 +0000 cap_net: plug memory leak MFC after: 5 days (cherry picked from commit 88910b8b7b14386e05bccda0317ace2bfd383ef5) --- 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 a1a66a05b5a2..c6abaa69faf6 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;