diff options
author | Yehuda Sadeh <yehuda@hq.newdream.net> | 2012-05-21 00:07:57 +0200 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-05-21 00:12:33 +0200 |
commit | 7eb29aeec6f75f482d9ea3b2f94eb6899b830c60 (patch) | |
tree | d5d638a7a3299ba8e88a9138989cba47e8642b50 /src/common/ConfUtils.cc | |
parent | crush: check malloc results (diff) | |
download | ceph-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.cc | 4 |
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)) { |