Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
#include "common/cmdparse.h"
#include "include/str_list.h"
#include "include/str_map.h"
+#include "include/scope_guard.h"
#include "json_spirit/json_spirit_reader.h"
p->decode(osdmap_bl);
}
+ auto sg = make_scope_guard([&] {
+ if (p != &osdmap) {
+ delete p;
+ }
+ });
+
if (prefix == "osd dump") {
stringstream ds;
if (f) {
rdata.append(ds);
}
- if (p != &osdmap)
- delete p;
} else if (prefix == "osd df") {
string method;
cmd_getval(g_ceph_context, cmdmap, "output_method", method);