Fix uninit'd memory issues in AMTL AString and Vector (bug 5921, r=psychonic).
--HG-- extra : rebase_source : 17a57dcf815cb3798eaa13af5f4af44fb1930f86
This commit is contained in:
parent
f0e4fe66ba
commit
398b05afed
@ -55,6 +55,8 @@ class AString
|
||||
AString(const AString &other) {
|
||||
if (other.length_)
|
||||
set(other.chars_, other.length_);
|
||||
else
|
||||
length_ = 0;
|
||||
}
|
||||
AString(Moveable<AString> other)
|
||||
: chars_(other->chars_.take()),
|
||||
|
@ -187,10 +187,10 @@ class Vector : public AllocPolicy
|
||||
|
||||
bool moveUp(size_t at) {
|
||||
assert(at < nitems_);
|
||||
if (!growIfNeeded(1))
|
||||
if (!append(Moveable<T>(data_[nitems_ - 1])))
|
||||
return false;
|
||||
nitems_++;
|
||||
for (size_t i = nitems_ - 1; i > at; i--)
|
||||
|
||||
for (size_t i = nitems_ - 2; i > at; i--)
|
||||
data_[i] = Moveable<T>(data_[i - 1]);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user