summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Becker <ben.becker@10gen.com>2012-02-09 14:36:00 -0800
committerBen Becker <ben.becker@10gen.com>2012-02-09 14:42:43 -0800
commit40e869df755b6c8107f2cda92cf34a12e24948de (patch)
treea6ca64bf59360c94db5c1c0441345792e8dfe207
parent656caeacc59470be383ce442ac8905b5cd1230c0 (diff)
downloadmongo-40e869df755b6c8107f2cda92cf34a12e24948de.tar.gz
SERVER-4806: check for BufBuilder realloc success. (thx @spencerjackson for pull req 169)
-rw-r--r--docs/errors.md1
-rw-r--r--src/mongo/bson/util/builder.h4
2 files changed, 4 insertions, 1 deletions
diff --git a/docs/errors.md b/docs/errors.md
index 676682ae5a1..60d18832fe1 100644
--- a/docs/errors.md
+++ b/docs/errors.md
@@ -63,6 +63,7 @@ src/mongo/bson/util/builder.h
* 13548 [code](http://github.com/mongodb/mongo/blob/master/src/mongo/bson/util/builder.h#L209)
* 15912 [code](http://github.com/mongodb/mongo/blob/master/src/mongo/bson/util/builder.h#L72) out of memory StackAllocator::Realloc
* 15913 [code](http://github.com/mongodb/mongo/blob/master/src/mongo/bson/util/builder.h#L122) out of memory BufBuilder::reset
+* 16070 [code](http://github.com/mongodb/mongo/blob/master/src/mongo/bson/util/builder.h#L212) out of memory BufBuilder::grow_reallocate
src/mongo/client/clientAndShell.cpp
diff --git a/src/mongo/bson/util/builder.h b/src/mongo/bson/util/builder.h
index bd6462cc6a3..38e606d4153 100644
--- a/src/mongo/bson/util/builder.h
+++ b/src/mongo/bson/util/builder.h
@@ -209,7 +209,9 @@ namespace mongo {
msgasserted(13548, ss.str().c_str());
}
data = (char *) al.Realloc(data, a);
- size= a;
+ if ( data == NULL )
+ msgasserted( 16070 , "out of memory BufBuilder::grow_reallocate" );
+ size = a;
}
char *data;