aboutsummaryrefslogtreecommitdiff
path: root/common/array.h
diff options
context:
space:
mode:
authorMax Horn2009-05-03 22:45:31 +0000
committerMax Horn2009-05-03 22:45:31 +0000
commit882c24d2ee9f71640bfc3be811b8dcddd91c9988 (patch)
tree50ebb0fea1e40cd922d0660588ba481141c9e49c /common/array.h
parentf108a31ad71404f115de776366dae985dd8e4f48 (diff)
downloadscummvm-rg350-882c24d2ee9f71640bfc3be811b8dcddd91c9988.tar.gz
scummvm-rg350-882c24d2ee9f71640bfc3be811b8dcddd91c9988.tar.bz2
scummvm-rg350-882c24d2ee9f71640bfc3be811b8dcddd91c9988.zip
COMMON: Check for failed memory allocations; changed Common::String to use new/delete instead of malloc/free
svn-id: r40291
Diffstat (limited to 'common/array.h')
-rw-r--r--common/array.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/array.h b/common/array.h
index 7ac08efa92..ace5ce7e4b 100644
--- a/common/array.h
+++ b/common/array.h
@@ -54,6 +54,7 @@ public:
Array(const Array<T> &array) : _capacity(0), _size(0), _storage(0) {
_capacity = _size = array._size;
_storage = new T[_capacity];
+ assert(_storage);
copy(array._storage, array._storage + _size, _storage);
}
@@ -64,6 +65,7 @@ public:
Array(const T2 *data, int n) {
_capacity = _size = n;
_storage = new T[_capacity];
+ assert(_storage);
copy(data, data + _size, _storage);
}
@@ -149,6 +151,7 @@ public:
_size = array._size;
_capacity = _size + 32;
_storage = new T[_capacity];
+ assert(_storage);
copy(array._storage, array._storage + _size, _storage);
return *this;
@@ -193,6 +196,7 @@ public:
T *old_storage = _storage;
_capacity = newCapacity;
_storage = new T[newCapacity];
+ assert(_storage);
if (old_storage) {
// Copy old data