summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/jsobjtests.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2014-08-13 16:02:17 -0400
committerBenety Goh <benety@mongodb.com>2014-08-15 01:44:41 -0400
commitbe05259d36ec5f44c821c8f2d103a4ee83ebaf53 (patch)
tree08564e54e580e6dde94b7a5e89e8c4021fa457ef /src/mongo/dbtests/jsobjtests.cpp
parent7a1a0ce4ca6bbdf047adc7528310078ef7ca08f8 (diff)
downloadmongo-be05259d36ec5f44c821c8f2d103a4ee83ebaf53.tar.gz
SERVER-14889 wrapped all malloc/realloc calls within src/mongo with mongoMalloc/mongoRealloc.
if memory allocation fails, report error and exit.
Diffstat (limited to 'src/mongo/dbtests/jsobjtests.cpp')
-rw-r--r--src/mongo/dbtests/jsobjtests.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/dbtests/jsobjtests.cpp b/src/mongo/dbtests/jsobjtests.cpp
index 63bb0f18363..2b4e7918017 100644
--- a/src/mongo/dbtests/jsobjtests.cpp
+++ b/src/mongo/dbtests/jsobjtests.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/storage/mmap_v1/btree/key.h"
#include "mongo/dbtests/dbtests.h"
#include "mongo/platform/float_utils.h"
+#include "mongo/util/allocator.h"
#include "mongo/util/embedded_builder.h"
#include "mongo/util/log.h"
#include "mongo/util/stringutils.h"
@@ -2018,7 +2019,7 @@ namespace JsobjTests {
void run() {
BSONObj x = BSON( "_id" << 5 << "t" << 2 );
{
- char * crap = (char*)malloc( x.objsize() );
+ char * crap = (char*)mongoMalloc( x.objsize() );
memcpy( crap , x.objdata() , x.objsize() );
BSONObj y( crap );
ASSERT_EQUALS( x , y );
@@ -2026,7 +2027,7 @@ namespace JsobjTests {
}
{
- char * crap = (char*)malloc( x.objsize() );
+ char * crap = (char*)mongoMalloc( x.objsize() );
memcpy( crap , x.objdata() , x.objsize() );
int * foo = (int*)crap;
foo[0] = 123123123;