From nobody Thu Feb 08 06:48:14 2024 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 4TVncb0TVQz595f3; Thu, 8 Feb 2024 06:48:15 +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 4TVncZ6jRBz4LHH; Thu, 8 Feb 2024 06:48:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707374894; 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=yGPQbZivvUdnzg+YWU4Q2FY3pwCq8tRatlq/gF3L4qU=; b=ac3PQ1RxIhidQ3yMBgiemnY5m0mPt3a+J8zpvAyRjoaE/ov42PjITO914aTmgCfdOdoCBJ FySgmTxjxHWUqp+vPybeocNNomyfARQQkuydsyY5tdULXqIORHLfKFEycFyNT3MhJeeysT pRgMs6SdlKuX+Jyli7LZwkAIP/ZA4g8opMLn2om1YfNd91vwYJecFOmxtUegUayIKe6m5t ghh2jreBqda+D4b98gDsoW06FgGkmTYMKhH5L1vQYWMPNdf+3Lyo7qepumu130AzCc6HoI 6n68HxJ1STH9CBgak4/fGfNpAsDYfk4YSeD/yafiVGI8jlM3uWOzOhi69utILA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707374894; 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=yGPQbZivvUdnzg+YWU4Q2FY3pwCq8tRatlq/gF3L4qU=; b=IYtomCWh9jO9OobAKbWiVRc8uMke/5SUfJM5K0CToUsW/1ASgocBE7hS7PHRptJF0pR5B6 XalBEpefJa6rmoXGQ6UcP3cL9KoMrlcZGRCtjnSz0eCGJt2+QP9hStzL6BgK4yNwas8ptS U3NcTs7UYmBJP6A5MoPLTcPdrml4/tRU1J7odEkxOZ07FUbLOGl0v443++2X/tBbhm+ezu iBcXxkbsGJVs7o6ICcRczWMmV/BXHJDoHBxqqz/NLe65PUqrGFgFtK1eq+XOOiJD2F8sf6 SDzAosbn9OgoSsn0HObVwgSFKlpRUKGehytQ9L/l0AVXLUu4Jm6OgNx0qVZMIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707374894; a=rsa-sha256; cv=none; b=Y1avCY88UtdYPCwjd5Ang3mgUJrnxNqUY4BwTxgBLsmfGG4jsA+bmxAGezw93K2rGImv71 NobB9UMaWyNrhZC3vAkawnq1JwijHIf92RU/PhVyFrO0fBv8q2FIweTGT85Va2xuiy20Qm 4XyakWAWmZEMBqzEkTLlyap7WkgnnSiblWIiJ3IETNjk/RERvryVfLZOlQNBQ55IXYDhnW Dy/QtexNs1fvDLtUzswOg7gXAiTaFjQ48upQP3LcSq30DjW8UeWL/SWgMMtlMJnbR7eOx2 o9acXo3Sm7NZhA9EE2cXd7L14jT7+R7UnoxauhvR6CbMxq/ntyfhFz5AyKwgzA== 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 4TVncZ5jDtzg5W; Thu, 8 Feb 2024 06:48:14 +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 4186mEch031513; Thu, 8 Feb 2024 06:48:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4186mEd3031510; Thu, 8 Feb 2024 06:48:14 GMT (envelope-from git) Date: Thu, 8 Feb 2024 06:48:14 GMT Message-Id: <202402080648.4186mEd3031510@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hiroki Sato Subject: git: 4594eb454891 - main - systat(1): Plug memory leak 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4594eb454891e6247a6ea786f467a0b960ddd835 Auto-Submitted: auto-generated The branch main has been updated by hrs: URL: https://cgit.FreeBSD.org/src/commit/?id=4594eb454891e6247a6ea786f467a0b960ddd835 commit 4594eb454891e6247a6ea786f467a0b960ddd835 Author: Hiroki Sato AuthorDate: 2024-02-08 06:45:04 +0000 Commit: Hiroki Sato CommitDate: 2024-02-08 06:45:04 +0000 systat(1): Plug memory leak The procstat_getprocs() function call in procgetinfo() allocated a buffer but it was not freed properly. --- usr.bin/systat/proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/systat/proc.c b/usr.bin/systat/proc.c index b42d5236927f..25ee286be780 100644 --- a/usr.bin/systat/proc.c +++ b/usr.bin/systat/proc.c @@ -205,7 +205,7 @@ per_proc_swap_usage(struct kinfo_proc *kipp) } while (vmobj != 0); } } - free(freep); + procstat_freevmmap(prstat, freep); return (pages); } @@ -272,6 +272,7 @@ procgetinfo(void) } if (nproc > 1) qsort(pu, nproc, sizeof(*pu), proc_compar); + procstat_freeprocs(prstat, kipp); } void