`make_unique<T>(args...)` itself uses `new T(args...)`, so this code was
allocating an extra Formatter pointer, and passing that to the actual
Formatter's constructor where it was converted to `bool pretty` and so
never freed. this also prevented `bool pretty_format` from taking effect
Signed-off-by: Casey Bodley <cbodley@redhat.com>
}
if (format == "xml")
- formatter = make_unique<XMLFormatter>(new XMLFormatter(pretty_format));
+ formatter = make_unique<XMLFormatter>(pretty_format);
else if (format == "json")
- formatter = make_unique<JSONFormatter>(new JSONFormatter(pretty_format));
+ formatter = make_unique<JSONFormatter>(pretty_format);
else {
cerr << "unrecognized format: " << format << std::endl;
exit(1);
}
- zone_formatter = std::make_unique<JSONFormatter_PrettyZone>(new JSONFormatter_PrettyZone(pretty_format));
+ zone_formatter = std::make_unique<JSONFormatter_PrettyZone>(pretty_format);
realm_name = g_conf()->rgw_realm;
zone_name = g_conf()->rgw_zone;