[llvm] r289582 - ADT: Use delete[] to delete the array owned by OwningArrayRef, as we created it with new[].
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 12:30:12 PST 2016
Author: pcc
Date: Tue Dec 13 14:30:12 2016
New Revision: 289582
URL: http://llvm.org/viewvc/llvm-project?rev=289582&view=rev
Log:
ADT: Use delete[] to delete the array owned by OwningArrayRef, as we created it with new[].
Modified:
llvm/trunk/include/llvm/ADT/ArrayRef.h
Modified: llvm/trunk/include/llvm/ADT/ArrayRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ArrayRef.h?rev=289582&r1=289581&r2=289582&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ArrayRef.h (original)
+++ llvm/trunk/include/llvm/ADT/ArrayRef.h Tue Dec 13 14:30:12 2016
@@ -424,12 +424,12 @@ namespace llvm {
}
OwningArrayRef(OwningArrayRef &&Other) { *this = Other; }
OwningArrayRef &operator=(OwningArrayRef &&Other) {
- delete this->data();
+ delete[] this->data();
this->MutableArrayRef<T>::operator=(Other);
Other.MutableArrayRef<T>::operator=(MutableArrayRef<T>());
return *this;
}
- ~OwningArrayRef() { delete this->data(); }
+ ~OwningArrayRef() { delete[] this->data(); }
};
/// @name ArrayRef Convenience constructors
More information about the llvm-commits
mailing list