[llvm] r325099 - Use delete[] to deallocate array of chars

Serge Pavlov via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 21:14:31 PST 2018


Author: sepavloff
Date: Tue Feb 13 21:14:31 2018
New Revision: 325099

URL: http://llvm.org/viewvc/llvm-project?rev=325099&view=rev
Log:
Use delete[] to deallocate array of chars

Modified:
    llvm/trunk/tools/llvm-objdump/MachODump.cpp

Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=325099&r1=325098&r2=325099&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Tue Feb 13 21:14:31 2018
@@ -2760,7 +2760,7 @@ static void method_reference(struct Disa
     if (strcmp(*ReferenceName, "_objc_msgSend") == 0) {
       if (info->selector_name != nullptr) {
         if (info->method != nullptr)
-          delete info->method;
+          delete[] info->method;
         if (info->class_name != nullptr) {
           info->method = new char[5 + strlen(info->class_name) +
                                   strlen(info->selector_name)];
@@ -2793,7 +2793,7 @@ static void method_reference(struct Disa
     } else if (strcmp(*ReferenceName, "_objc_msgSendSuper2") == 0) {
       if (info->selector_name != nullptr) {
         if (info->method != nullptr)
-          delete info->method;
+          delete[] info->method;
         info->method = new char[17 + strlen(info->selector_name)];
         if (info->method != nullptr) {
           if (Arch == Triple::x86_64)




More information about the llvm-commits mailing list