Skip to content

Commit c9b09a9

Browse files
committed
kconfig: qconf: use delete[] instead of delete to free array
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: c4f7398 ("kconfig: qconf: make debug links work again") Reported-by: David Binderman <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 0e912c0 commit c9b09a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/kconfig/qconf.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ void ConfigInfoView::clicked(const QUrl &url)
12381238

12391239
if (count < 1) {
12401240
qInfo() << "Clicked link is empty";
1241-
delete data;
1241+
delete[] data;
12421242
return;
12431243
}
12441244

@@ -1251,7 +1251,7 @@ void ConfigInfoView::clicked(const QUrl &url)
12511251
result = sym_re_search(data);
12521252
if (!result) {
12531253
qInfo() << "Clicked symbol is invalid:" << data;
1254-
delete data;
1254+
delete[] data;
12551255
return;
12561256
}
12571257

0 commit comments

Comments
 (0)