mon: Monitor: fix potential null-pointer dereference

CID 717443: Dereference after null check (FORWARD_NULL)
At (14): Passing null pointer "detailbl" to function
"ceph::buffer::list::append(std::string const &)", which dereferences it.


Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
This commit is contained in:
Joao Eduardo Luis 2012-10-17 15:23:11 +01:00
parent 64bf7f9b28
commit 52dedc8986

View File

@ -1324,8 +1324,10 @@ void Monitor::get_health(string& status, bufferlist *detailbl, Formatter *f)
while (!detail.empty()) {
if (f)
f->dump_string("item", detail.front().second);
detailbl->append(detail.front().second);
detailbl->append('\n');
if (detailbl != NULL) {
detailbl->append(detail.front().second);
detailbl->append('\n');
}
detail.pop_front();
}
if (f)