public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kconfig: qconf: use delete[] instead of delete to free array (again)
@ 2020-09-08 22:16 Masahiro Yamada
  2020-09-08 22:16 ` [PATCH 2/2] kconfig: fix incomplete type 'struct gstr' warning Masahiro Yamada
  2020-09-10 17:24 ` [PATCH 1/2] kconfig: qconf: use delete[] instead of delete to free array (again) Nick Desaulniers
  0 siblings, 2 replies; 6+ messages in thread
From: Masahiro Yamada @ 2020-09-08 22:16 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Mauro Carvalho Chehab, Nathan Chancellor,
	Nick Desaulniers, clang-built-linux, linux-kernel

Commit c9b09a9249e6 ("kconfig: qconf: use delete[] instead of delete
to free array") fixed two lines, but there is one more.
(cppcheck does not report it for some reason...)

This was detected by Clang.

"make HOSTCXX=clang++ xconfig" reports the following:

scripts/kconfig/qconf.cc:1279:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
        delete data;
        ^
              []
scripts/kconfig/qconf.cc:1239:15: note: allocated with 'new[]' here
        char *data = new char[count + 1];
                     ^

Fixes: c4f7398bee9c ("kconfig: qconf: make debug links work again")
Fixes: c9b09a9249e6 ("kconfig: qconf: use delete[] instead of delete to free array")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/qconf.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 8638785328a7..c7216b9110fc 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1276,7 +1276,7 @@ void ConfigInfoView::clicked(const QUrl &url)
 	}
 
 	free(result);
-	delete data;
+	delete[] data;
 }
 
 void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-17 16:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-08 22:16 [PATCH 1/2] kconfig: qconf: use delete[] instead of delete to free array (again) Masahiro Yamada
2020-09-08 22:16 ` [PATCH 2/2] kconfig: fix incomplete type 'struct gstr' warning Masahiro Yamada
2020-09-09 14:09   ` Boris Kolpackov
2020-09-17 16:07     ` Masahiro Yamada
2020-09-10 17:24 ` [PATCH 1/2] kconfig: qconf: use delete[] instead of delete to free array (again) Nick Desaulniers
2020-09-17 16:08   ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox