diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-11-08 09:56:42 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-11-08 09:56:42 -0500 |
commit | 024f7daec490322cafabae5243fc4ca60698bf66 (patch) | |
tree | 3da0982f38cbdbf5688c0886e5ee71ce3b15cf3d /bson | |
parent | fe7f1c66ffa4490b24f5b314e918115afa353db5 (diff) | |
download | mongo-024f7daec490322cafabae5243fc4ca60698bf66.tar.gz |
fix some unchecked mallocs SERVER-4228
Diffstat (limited to 'bson')
-rw-r--r-- | bson/util/builder.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bson/util/builder.h b/bson/util/builder.h index 710c2d43699..f189f58b27e 100644 --- a/bson/util/builder.h +++ b/bson/util/builder.h @@ -65,6 +65,8 @@ namespace mongo { if( p == buf ) { if( sz <= SZ ) return buf; void *d = malloc(sz); + if ( d == 0 ) + msgasserted( 15912 , "out of memory StackAllocator::Realloc" ); memcpy(d, p, SZ); return d; } @@ -113,6 +115,8 @@ namespace mongo { if ( maxSize && size > maxSize ) { al.Free(data); data = (char*)al.Malloc(maxSize); + if ( data == 0 ) + msgasserted( 15913 , "out of memory BufBuilder::reset" ); size = maxSize; } } |