summaryrefslogtreecommitdiff
path: root/src/mongo/util/text.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/util/text.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/util/text.cpp')
-rw-r--r--src/mongo/util/text.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/util/text.cpp b/src/mongo/util/text.cpp
index 5c3693901d1..1a11222613d 100644
--- a/src/mongo/util/text.cpp
+++ b/src/mongo/util/text.cpp
@@ -39,6 +39,7 @@
#endif
#include "mongo/platform/basic.h"
+#include "mongo/util/allocator.h"
#include "mongo/util/mongoutils/str.h"
using namespace std;
@@ -303,7 +304,7 @@ namespace mongo {
utf8argLength.push_back(argLength);
blockSize += argLength;
}
- _argv = static_cast<char**>(malloc(blockSize));
+ _argv = static_cast<char**>(mongoMalloc(blockSize));
for (int i = 0; i < argc; ++i) {
_argv[i] = reinterpret_cast<char*>(_argv) + blockPtr;
strcpy_s(_argv[i], utf8argLength[i], utf8args[i].c_str());
@@ -326,7 +327,7 @@ namespace mongo {
utf8envLength.push_back(envLength);
blockSize += envLength;
}
- _envp = static_cast<char**>(malloc(blockSize));
+ _envp = static_cast<char**>(mongoMalloc(blockSize));
size_t i;
for (i = 0; i < envCount; ++i) {
_envp[i] = reinterpret_cast<char*>(_envp) + blockPtr;