From nobody Sun Feb 4 09:53:53 2024 X-Original-To: threads@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 4TSPwd2N9Qz59S2D for ; Sun, 4 Feb 2024 09:53:53 +0000 (UTC) (envelope-from bugzilla-noreply@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 4TSPwd01Ywz49nf for ; Sun, 4 Feb 2024 09:53:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707040433; 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: in-reply-to:in-reply-to:references:references; bh=2/vB6b9QBBcMS0ylzIECRdar0O8tLQKmEIJvm5b45fk=; b=NWPOr3cTc6bg7Yjh343BFyTiVLKVQfpeLvl27SoWjosfncjlGxkd4Kolf/IWGTdHIQc2nG JxnV5CjqJ7dsSo9U1c0d23X1PSRtZQV0FTXbqCpadeo29g2+vPxP6GTM2QCAisGF2sOI62 Pv55ycfLHALgBYZ0uaofkocx44Z5acBsRoCpoJlYHYwF7TpgNUL9UcG4wU4jNet6cnzfvc 5SFeLob7XKhCiUS+/977HU99yVkJF4vrqTNBlOmUjS+43r59Wxew5xr6ElJpUn8XtzklU7 lXYRi+WHMV3qGBme3hapQmJ/Wv5AegpwAWht49hQuO+DqAFqfnsDW8lTwuoolw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707040433; a=rsa-sha256; cv=none; b=WX2SzW8jLtmSi+IC0kWOMiEA0We0RZimRK3mzmYSS5EtWEJurnelHP6/gPb9poZDIrnR4u 6cnVG+FIdciKE6ypWmg7iqzdnMTa6ZpofE+eNvp+F19JcLtzivCkhZhnh9h0L1HEmxKct3 bIhdj0oB9jOlqY6gsDbsyERpWewDbmIA2EzgUffApK/JJpXVLJaQJuJqNNuG3SEwzVHrYH DaY+aJE5tB3CYxxunBk4TCHy7cgm8dWQRzDBbnjy7DDuSjEWHYp6BWN2g6zokVuhWuk1+c WJA/YOLWFSwrM/sYehAJNz7gUWjSxx6ZKzsJlRxZUynzxaBRcjRZzayfNHEkXQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4TSPwc6CCMzsQv for ; Sun, 4 Feb 2024 09:53:52 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 4149rqEI041010 for ; Sun, 4 Feb 2024 09:53:52 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 4149rqHg041009 for threads@FreeBSD.org; Sun, 4 Feb 2024 09:53:52 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: threads@FreeBSD.org Subject: [Bug 276818] [libc] mtx_init memory leak Date: Sun, 04 Feb 2024 09:53:53 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: threads X-Bugzilla-Version: 14.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: hodong@nimfsoft.art X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: threads@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: short_desc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Threading List-Archive: https://lists.freebsd.org/archives/freebsd-threads List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-threads@freebsd.org X-BeenThere: freebsd-threads@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D276818 Hodong changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|mtx |[libc] mtx_init memory leak --- Comment #1 from Hodong --- Hello. A memory leak occurs in mtx_init. #include int main () { mtx_t mtx; mtx_init (&mtx, mtx_plain); mtx_destroy (&mtx); return 0; } $ cc mtx.c -lstdthreads -o mtx $ valgrind --leak-check=3Dfull ./mtx =3D=3D26748=3D=3D Memcheck, a memory error detector =3D=3D26748=3D=3D Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward = et al. =3D=3D26748=3D=3D Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyr= ight info =3D=3D26748=3D=3D Command: ./mtx =3D=3D26748=3D=3D=20 =3D=3D26748=3D=3D=20 =3D=3D26748=3D=3D HEAP SUMMARY: =3D=3D26748=3D=3D in use at exit: 1,748 bytes in 3 blocks =3D=3D26748=3D=3D total heap usage: 3 allocs, 0 frees, 1,748 bytes alloca= ted =3D=3D26748=3D=3D=20 =3D=3D26748=3D=3D 20 bytes in 1 blocks are definitely lost in loss record 1= of 3 =3D=3D26748=3D=3D at 0x484CDE4: malloc (vg_replace_malloc.c:446) =3D=3D26748=3D=3D by 0x4C791B2: pthread_mutexattr_init (in /lib/libthr.s= o.3) =3D=3D26748=3D=3D by 0x485EA9D: mtx_init (in /usr/lib/libstdthreads.so.0) =3D=3D26748=3D=3D by 0x2016FC: main (in /home/hodong/projects/snippets/m= tx) =3D=3D26748=3D=3D=20 =3D=3D26748=3D=3D LEAK SUMMARY: =3D=3D26748=3D=3D definitely lost: 20 bytes in 1 blocks =3D=3D26748=3D=3D indirectly lost: 0 bytes in 0 blocks =3D=3D26748=3D=3D possibly lost: 0 bytes in 0 blocks =3D=3D26748=3D=3D still reachable: 1,728 bytes in 2 blocks =3D=3D26748=3D=3D suppressed: 0 bytes in 0 blocks =3D=3D26748=3D=3D Reachable blocks (those to which a pointer was found) are= not shown. =3D=3D26748=3D=3D To see them, rerun with: --leak-check=3Dfull --show-leak-= kinds=3Dall =3D=3D26748=3D=3D=20 =3D=3D26748=3D=3D For lists of detected and suppressed errors, rerun with: = -s =3D=3D26748=3D=3D ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 fr= om 0) --=20 You are receiving this mail because: You are the assignee for the bug.=