From nobody Fri Feb 09 00:38:30 2024 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 4TWFMW2Lzvz58V6r; Fri, 9 Feb 2024 00:38:31 +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 4TWFMW1W67z42pZ; Fri, 9 Feb 2024 00:38:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707439111; 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=AuiJo7T0fgnn8oVMgXwKjDHswhwGxctFh/8i47ixVTg=; b=JOYwYkDQuRQa7axT6iTqOSgFo0KwffAhR5P0Swhw773j2iB9reqb+nG3wGDzGHmYv0nf/S p4Y5oKYQuFkTY3HDv2R5IMcW/ki/PjTDBsy1iyqXxETGnpwCd6JMoyZWsaEeFls8O/qqyY 1AxNzONTx8xOWDbuyeZFX89rKkYm5y8TKwUWeB44ndn5T7c+hDv+cZRSZDVREzQqGxn5M8 XLafuJ9YL29bVCmnVlxXcRr/wEn9JX4SNjufEu2dVPv1+0W4Vjmcp/QJuJ+S2tLAGbZ3n6 UwoaSz4UJyEouMamChX2nOAgO7gJcVMPRMnARLT545ozAer3zgsaoH9eziQcMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707439111; 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=AuiJo7T0fgnn8oVMgXwKjDHswhwGxctFh/8i47ixVTg=; b=uOKwlYv0BqV6fQYWLRW/QmMk/k8k+DRxohY/aCaEDiNZmsnxzklw8kiq8WXRoVUHPAILYy KeTwkbhbw1S7ApEyXsAmR5I3uZ5wV6gIGPGeFE7MwIiahShgko/TIbo0SMC6iv6UKJPqzv TPn5WREFOSWCQ2vUy7LHO58zOHBNr3OQ5lZthA01/9cBSU3BOeKkRWAin8mOXg8OZVPyxn rS9x1qHvZYnF1RFAhuQw1tYf86kEZx5yRxPMtvanszx9kWwU87+wpzrOslMRyIomfPj8xf pLUkicNmqCW3kVExHrNkX2p+mbJcW/Obrqq1wLLYwjUeXifb3nHYPAj4ZXWoEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707439111; a=rsa-sha256; cv=none; b=Pv+bkjLy/CuclZFTb3oGPHpY+lPeO963FOb7GYsTIrFfL96Ry8U0TMtc/MuUfk654VzqHx /dj3T2keH8u6Euke88oKi5qOM49HTuI06g1kF6QqOCO/PkPfyJCyx4Xmvf4453JOQ5MxQo +1JXRt7mCLE+BsgUP4Y1+UEaAFJRiW3750aiRheJJEQ6jL5PAoZ6TKEqICIFOpJr78Wzj7 4lBUptW02XJr6OVRU176t6e4iy7I9H8iSZ4d5cuKacLlQK5CpKaarYeaFrbUXLnkzIG+Y8 cyM8SrVKR9sM0esC4q1zeYpKAGiX3au3Rpr3UHVQqShY9okXlLx78QkU1WSlnw== 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 4TWFMW0YDFz1B5F; Fri, 9 Feb 2024 00:38:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4190cUcK028061; Fri, 9 Feb 2024 00:38:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4190cUCh028058; Fri, 9 Feb 2024 00:38:30 GMT (envelope-from git) Date: Fri, 9 Feb 2024 00:38:30 GMT Message-Id: <202402090038.4190cUCh028058@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: e4cfb5981d2b - stable/14 - libstdthreads: destroy mutexattr in mtx_init() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: e4cfb5981d2bf54a9bf4c676f5177648644d7db6 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e4cfb5981d2bf54a9bf4c676f5177648644d7db6 commit e4cfb5981d2bf54a9bf4c676f5177648644d7db6 Author: Hodong AuthorDate: 2024-02-04 10:14:22 +0000 Commit: Konstantin Belousov CommitDate: 2024-02-09 00:38:04 +0000 libstdthreads: destroy mutexattr in mtx_init() PR: 276818 (cherry picked from commit a03f768612ad98a886458197c531a0b92203bf84) --- lib/libstdthreads/mtx.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/libstdthreads/mtx.c b/lib/libstdthreads/mtx.c index 719ba6486e41..3027a4e48c8d 100644 --- a/lib/libstdthreads/mtx.c +++ b/lib/libstdthreads/mtx.c @@ -43,7 +43,7 @@ int mtx_init(mtx_t *mtx, int type) { pthread_mutexattr_t attr; - int mt; + int mt, res; switch (type) { case mtx_plain: @@ -60,11 +60,12 @@ mtx_init(mtx_t *mtx, int type) if (pthread_mutexattr_init(&attr) != 0) return (thrd_error); - if (pthread_mutexattr_settype(&attr, mt) != 0) - return (thrd_error); - if (pthread_mutex_init(mtx, &attr) != 0) - return (thrd_error); - return (thrd_success); + res = thrd_success; + if (pthread_mutexattr_settype(&attr, mt) != 0 || + pthread_mutex_init(mtx, &attr) != 0) + res = thrd_error; + pthread_mutexattr_destroy(&attr); + return (res); } int