From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: David Binderman <dcb314@hotmail.com>,
Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
Masahiro Yamada <masahiroy@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/3] kconfig: qconf: use delete[] instead of delete to free array
Date: Thu, 30 Jul 2020 02:02:39 +0900 [thread overview]
Message-ID: <20200729170239.160208-3-masahiroy@kernel.org> (raw)
In-Reply-To: <20200729170239.160208-1-masahiroy@kernel.org>
cppcheck reports "Mismatching allocation and deallocation".
$ cppcheck scripts/kconfig/qconf.cc
Checking scripts/kconfig/qconf.cc ...
scripts/kconfig/qconf.cc:1242:10: error: Mismatching allocation and deallocation: data [mismatchAllocDealloc]
delete data;
^
scripts/kconfig/qconf.cc:1236:15: note: Mismatching allocation and deallocation: data
char *data = new char[count + 1];
^
scripts/kconfig/qconf.cc:1242:10: note: Mismatching allocation and deallocation: data
delete data;
^
scripts/kconfig/qconf.cc:1255:10: error: Mismatching allocation and deallocation: data [mismatchAllocDealloc]
delete data;
^
scripts/kconfig/qconf.cc:1236:15: note: Mismatching allocation and deallocation: data
char *data = new char[count + 1];
^
scripts/kconfig/qconf.cc:1255:10: note: Mismatching allocation and deallocation: data
delete data;
^
Fixes: c4f7398bee9c ("kconfig: qconf: make debug links work again")
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
Changes in v2:
- Remove the description about the remaining qconf.moc
scripts/kconfig/qconf.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index bb0a0bd511b9..3a11940ff5dc 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1238,7 +1238,7 @@ void ConfigInfoView::clicked(const QUrl &url)
if (count < 1) {
qInfo() << "Clicked link is empty";
- delete data;
+ delete[] data;
return;
}
@@ -1251,7 +1251,7 @@ void ConfigInfoView::clicked(const QUrl &url)
result = sym_re_search(data);
if (!result) {
qInfo() << "Clicked symbol is invalid:" << data;
- delete data;
+ delete[] data;
return;
}
--
2.25.1
prev parent reply other threads:[~2020-07-29 17:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 17:02 [PATCH v2 1/3] kconfig: qconf: use if_changed for qconf.moc rule Masahiro Yamada
2020-07-29 17:02 ` [PATCH v2 2/3] kconfig: qconf: compile moc object separately Masahiro Yamada
2020-07-29 17:02 ` Masahiro Yamada [this message]
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=20200729170239.160208-3-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=dcb314@hotmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab+huawei@kernel.org \
/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).