Fix garbled dates when using --date-format
Capture the `std::string` value from options in a local variable that lives as long as the `c_str()` taken from it to ensure it does not get freed prematurely. Fixes: #546
This commit is contained in:
parent
db42d7b252
commit
850a2cec79
1 changed files with 3 additions and 1 deletions
|
|
@ -103,11 +103,13 @@ namespace {
|
|||
void print_xact(report_t& report, std::ostream& out, xact_t& xact)
|
||||
{
|
||||
format_type_t format_type = FMT_WRITTEN;
|
||||
string format_str;
|
||||
optional<const char *> format;
|
||||
|
||||
if (report.HANDLED(date_format_)) {
|
||||
format_type = FMT_CUSTOM;
|
||||
format = report.HANDLER(date_format_).str().c_str();
|
||||
format_str = report.HANDLER(date_format_).str();
|
||||
format = format_str.c_str();
|
||||
}
|
||||
|
||||
std::ostringstream buf;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue