diff --git a/src/Val.cc b/src/Val.cc index 907a29d062..53aecb0bbb 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -479,11 +479,7 @@ static ZeekJson BuildJSON(Val* val, bool only_loggable=false, RE_Matcher* re=nul ODesc d; d.SetStyle(RAW_STYLE); val->Describe(&d); - - auto* bs = new BroString(1, d.TakeBytes(), d.Len()); - j = string((char*)bs->Bytes(), bs->Len()); - - delete bs; + j = string(reinterpret_cast(d.Bytes()), d.Len()); break; } @@ -495,11 +491,7 @@ static ZeekJson BuildJSON(Val* val, bool only_loggable=false, RE_Matcher* re=nul ODesc d; d.SetStyle(RAW_STYLE); val->Describe(&d); - - auto* bs = new BroString(1, d.TakeBytes(), d.Len()); - j = json_escape_utf8(string((char*)bs->Bytes(), bs->Len())); - - delete bs; + j = json_escape_utf8(string(reinterpret_cast(d.Bytes()), d.Len())); break; }