From nobody Thu Sep 03 05:04:01 2026 X-Original-To: dev-commits-src-main@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 4hb6vV5mCZz6qcVW for ; Thu, 03 Sep 2026 05:04:06 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hb6vV4zQBz466s for ; Thu, 03 Sep 2026 05:04:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788411846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sMsz1br7LDpOwYngGimT+tXyAreA9QbCSXcHXCN6Doc=; b=U7JSSeW1x1Ix3E6nl3w6qpd07T0y59l4/ykLDt0LXg2etHWvQ80kO+fw2jjtBAngVfCeFR fR7zf8IFhY08UJCW+derpbm3vXVrAT8Praa36iy8IrrL2FOQogPQYHVF19LHEU8tcJbFUV K1FELtt6Gl0lp4Ov9e8qE/NnTywMfh6Lk65H12AqfDk/81XWBlD1biVo6+obWESDezj1do ad6S2a/xhnPtQ4TvU1wGzLFIsaFmKfZ8txvb9igIVHwHgh+h7t01nIiYFq/pH+BROTY+Sm Ft7XdfgQHNWJJyAMPQeYcBSMalaZu/yXWv4hVfc2T9t3KbAB+TJ7886hFHnL+A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788411846; a=rsa-sha256; cv=none; b=QXHR1WPkcdilcBgBiLPs7pEP4pO8kXrOXdtpSXfIhUibpxHWaEJ/SQoopfnhXK5fsa9JX+ O32LemvXtppybAPPqUZYRqGu3+OkHUZBstC66JqZOSy63Z2YrUgtWSLJ67FeW8PmRx0mtt 622Ibn2qMQ51Q/xPUhnolcQBt5QwBPzlyjbKH47SgGDOQZG4Bs8Hb/EGeZiK72EQQQwYcn WiB/6TNaIqSv02HAsc1SOTDx9SjD+OR8CVL5dI1nYgA0Rl6H/Au+hD3/T0wmlJVasKVHax DBahCbxR27v0V23DGqtpuef1ofGPXm5KAeXFVarMnz4CKSzRgjFbmt5Owh44ng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788411846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sMsz1br7LDpOwYngGimT+tXyAreA9QbCSXcHXCN6Doc=; b=T1iM5kOQR/QN/wTzJ3gG9zMBLuUOPpniR9+WrRVI1VbjewtkCCqFRdcA0DW0DEJ+K/HMV7 vpHP1iMHejJ23uwGJRa3vuzDyaHOh7tp0MAVRlYlZD1yiEzzEbh/wj3jmchz1lSHLNeglr oNSOLw5jDV0BZxc+WwAyqiEg8wSaRduJGS5f6HnNs2zG77imhkSLzTVv3o8lCb818+3X7d PKNUT5YM9BLFdlvPvxyUhd0gl7PpXZViktFZr57ANQ3PTIJ5wmiX1yMUcRw4uVmlp7FpSI 0rgMQ7AhvkaTchKphJDSpQNw+zVrkEe6ICKfVSOWt9EPVptUL7t5xg0LTY2axw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hb6vV3q5Pz1F4t for ; Thu, 03 Sep 2026 05:04:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f551 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 03 Sep 2026 05:04:01 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Chris Suter From: Xin LI Subject: git: 6d49b0c0e7b8 - main - fsck_msdosfs: fix memory leaks in checkfilesys() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6d49b0c0e7b8b77d8043593356e712307e894743 Auto-Submitted: auto-generated Date: Thu, 03 Sep 2026 05:04:01 +0000 Message-Id: <6a98ffc1.3f551.2ebc2ce4@gitrepo.freebsd.org> The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=6d49b0c0e7b8b77d8043593356e712307e894743 commit 6d49b0c0e7b8b77d8043593356e712307e894743 Author: Chris Suter AuthorDate: 2026-08-04 05:58:25 +0000 Commit: Xin LI CommitDate: 2026-09-03 04:54:21 +0000 fsck_msdosfs: fix memory leaks in checkfilesys() Invoke releasefat(fat) in checkfilesys() prior to free(fat) on exit paths so that fatbuf, headbitmap.map, and fat32_cache entries are properly freed. MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/2351 --- sbin/fsck_msdosfs/check.c | 5 ++++- sbin/fsck_msdosfs/ext.h | 1 + sbin/fsck_msdosfs/fat.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sbin/fsck_msdosfs/check.c b/sbin/fsck_msdosfs/check.c index f672a2ac515c..e6c8ba24520f 100644 --- a/sbin/fsck_msdosfs/check.c +++ b/sbin/fsck_msdosfs/check.c @@ -181,7 +181,10 @@ checkfilesys(const char *fname) out: if (finish_dosdirsection) finishDosDirSection(); - free(fat); + if (fat) { + releasefat(fat); + free(fat); + } close(dosfs); if (mod & (FSFATMOD|FSDIRMOD)) diff --git a/sbin/fsck_msdosfs/ext.h b/sbin/fsck_msdosfs/ext.h index d0f4dd6279f7..80ad684e9622 100644 --- a/sbin/fsck_msdosfs/ext.h +++ b/sbin/fsck_msdosfs/ext.h @@ -109,6 +109,7 @@ bool fat_is_valid_cl(struct fat_descriptor *, cl_t); * descriptor of it. */ int readfat(int, struct bootblock *, struct fat_descriptor **); +void releasefat(struct fat_descriptor *); /* * Write back FAT entries diff --git a/sbin/fsck_msdosfs/fat.c b/sbin/fsck_msdosfs/fat.c index d71ac2b503f5..7d0ad9a595cf 100644 --- a/sbin/fsck_msdosfs/fat.c +++ b/sbin/fsck_msdosfs/fat.c @@ -783,7 +783,7 @@ err: return 0; } -static void +void releasefat(struct fat_descriptor *fat) { if (fat->is_mmapped) {