From 2b4b1f458364ddc486079302cfa88dbee2099076 Mon Sep 17 00:00:00 2001 From: Toby Searle <14909402+twsearle@users.noreply.github.com> Date: Fri, 26 Nov 2021 13:59:19 +0000 Subject: [PATCH] Resolve bad delete #98 Use `delete[]` rather `delete` for deleting heap allocated char array. --- cxx4/ncGroup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cxx4/ncGroup.cpp b/cxx4/ncGroup.cpp index 1680129..2b7e94e 100644 --- a/cxx4/ncGroup.cpp +++ b/cxx4/ncGroup.cpp @@ -104,7 +104,7 @@ string NcGroup::getName(bool fullName) const { char* charName= new char[lenp+1]; ncCheck(nc_inq_grpname_full(myId,&lenp,charName),__FILE__,__LINE__); groupName = charName; - delete charName; + delete[] charName; } else { // return the (local) name of this group.