Fix mismatched new/delete
authorJonathan Wakely <github@kayari.org>
Thu, 18 Feb 2021 17:13:24 +0000 (17:13 +0000)
committerMichael McMaster <michael@codesrc.com>
Mon, 26 Apr 2021 10:59:25 +0000 (20:59 +1000)
The buffers allocated with new[] need to be freed with delete[] not
plain delete.

src/scsi2sd-util6/TerminalWx/src/GTerm/gterm.cpp

index cbcd7761e4a19cd61032e74ad5a3c032352edfec..a5a47a4c2bb9c7fceaa025bcaded55a93534924d 100644 (file)
@@ -106,11 +106,11 @@ GTerm::GTerm(int w, int h) : width(w), height(h)
 
 GTerm::~GTerm()
 {
 
 GTerm::~GTerm()
 {
-       delete text;
-       delete color;
+       delete[] text;
+       delete[] color;
 #ifdef GTERM_PC
         if(pc_machinename)
 #ifdef GTERM_PC
         if(pc_machinename)
-          delete pc_machinename;
+          delete[] pc_machinename;
 #endif // GTERM_PC
 }
 
 #endif // GTERM_PC
 }