summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-03-09 09:38:00 +0000
committerrubidium <rubidium@openttd.org>2009-03-09 09:38:00 +0000
commit60de42be496215200986f6ed5f81a11280c44fbd (patch)
treea63c3729163ccf5b1c637ba9d01103839d3fe94a /src/core
parenta231ab7560cb27e5c217082dde3b4490cdc961e6 (diff)
downloadopenttd-60de42be496215200986f6ed5f81a11280c44fbd.tar.xz
(svn r15649) -Fix (r15556): don't unnecessarily reallocate
Diffstat (limited to 'src/core')
-rw-r--r--src/core/alloc_type.hpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/alloc_type.hpp b/src/core/alloc_type.hpp
index b95fc79ee..4451f0479 100644
--- a/src/core/alloc_type.hpp
+++ b/src/core/alloc_type.hpp
@@ -102,6 +102,7 @@ public:
if (this->count < count) {
free(this->buffer);
this->buffer = MallocT<T>(count);
+ this->count = count;
}
return this->buffer;
}
@@ -118,6 +119,7 @@ public:
if (this->count < count) {
free(this->buffer);
this->buffer = CallocT<T>(count);
+ this->count = count;
} else {
memset(this->buffer, 0, sizeof(T) * count);
}