From: Cryolitia PukNgae via B4 Relay <devnull+cryolitia.uniontech.com@kernel.org>
To: Thomas Renninger <trenn@suse.com>, Shuah Khan <shuah@kernel.org>,
"John B. Wyatt IV" <jwyatt@redhat.com>,
John Kacur <jkacur@redhat.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
niecheng1@uniontech.com, zhanjun@uniontech.com,
Cryolitia PukNgae <cryolitia@uniontech.com>
Subject: [PATCH] cpupower: fix memory leak in print_{on,off}line_cpus()
Date: Wed, 27 Aug 2025 17:46:04 +0800 [thread overview]
Message-ID: <20250827-power-memoryleak-v1-1-e4baf7b59a41@uniontech.com> (raw)
From: Cryolitia PukNgae <cryolitia@uniontech.com>
{on,off}online_cpus_str not free after use
Suggested-by: Jun Zhan <zhanjun@uniontech.com>
Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
---
tools/power/cpupower/utils/helpers/misc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c
index 166dc1e470ea6d70079fea6570750885d549603a..f3b4fe95520ff96a1be8b1ba8e7be1ec116b1bc0 100644
--- a/tools/power/cpupower/utils/helpers/misc.c
+++ b/tools/power/cpupower/utils/helpers/misc.c
@@ -213,6 +213,8 @@ void print_online_cpus(void)
bitmask_displaylist(online_cpus_str, str_len, online_cpus);
printf(_("Following CPUs are online:\n%s\n"), online_cpus_str);
}
+
+ free(online_cpus_str);
}
/* print_offline_cpus
@@ -232,6 +234,8 @@ void print_offline_cpus(void)
printf(_("Following CPUs are offline:\n%s\n"), offline_cpus_str);
printf(_("cpupower set operation was not performed on them\n"));
}
+
+ free(offline_cpus_str);
}
/*
---
base-commit: fab1beda7597fac1cecc01707d55eadb6bbe773c
change-id: 20250827-power-memoryleak-75c692220277
Best regards,
--
Cryolitia PukNgae <cryolitia@uniontech.com>
reply other threads:[~2025-08-27 9:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250827-power-memoryleak-v1-1-e4baf7b59a41@uniontech.com \
--to=devnull+cryolitia.uniontech.com@kernel.org \
--cc=cryolitia@uniontech.com \
--cc=jkacur@redhat.com \
--cc=jwyatt@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=niecheng1@uniontech.com \
--cc=shuah@kernel.org \
--cc=trenn@suse.com \
--cc=zhanjun@uniontech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).