Bug 1265036 - Use NS_ABORT_OOM() if try_realloc() fails. r=billm

This will give the crash a proper OOM annotation.
This commit is contained in:
Andrew McCreight 2016-04-16 10:47:46 -07:00
parent 97ce0e7053
commit fac746e08b

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "buffer.h"
#include "nsDebug.h"
Buffer::Buffer()
: mBuffer(nullptr),
@ -59,7 +60,9 @@ Buffer::try_realloc(size_t newlength)
// If we're growing the buffer, crash. If we're shrinking, then we continue to
// use the old (larger) buffer.
MOZ_RELEASE_ASSERT(newlength <= mReserved);
if (newlength > mReserved) {
NS_ABORT_OOM(newlength);
}
}
void