summaryrefslogtreecommitdiffstats
path: root/src/common/ConfUtils.cc
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2012-05-21 00:07:57 +0200
committerSage Weil <sage@inktank.com>2012-05-21 00:12:33 +0200
commit7eb29aeec6f75f482d9ea3b2f94eb6899b830c60 (patch)
treed5d638a7a3299ba8e88a9138989cba47e8642b50 /src/common/ConfUtils.cc
parentcrush: check malloc results (diff)
downloadceph-7eb29aeec6f75f482d9ea3b2f94eb6899b830c60.tar.xz
ceph-7eb29aeec6f75f482d9ea3b2f94eb6899b830c60.zip
check malloc return values
There were a few places where we didn't check malloc return code. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Diffstat (limited to 'src/common/ConfUtils.cc')
-rw-r--r--src/common/ConfUtils.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/ConfUtils.cc b/src/common/ConfUtils.cc
index d08f447755a..e339205b5ea 100644
--- a/src/common/ConfUtils.cc
+++ b/src/common/ConfUtils.cc
@@ -126,6 +126,10 @@ parse_file(const std::string &fname, std::deque<std::string> *errors)
sz = (size_t)st_buf.st_size;
buf = (char*)malloc(sz);
+ if (!buf) {
+ ret = -ENOMEM;
+ goto done;
+ }
if (fread(buf, 1, sz, fp) != sz) {
if (ferror(fp)) {