From 2072162d6a7a76d8be3fc07ac0f8d04b933ae842 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 19 Jul 2023 12:46:14 -0400 Subject: [PATCH] Add Reset() calls to have clean names and error text (#28066) --- src/lib/format/protocol_decoder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/format/protocol_decoder.cpp b/src/lib/format/protocol_decoder.cpp index a0dc009d3d97b0..4752dfaee9c8b4 100644 --- a/src/lib/format/protocol_decoder.cpp +++ b/src/lib/format/protocol_decoder.cpp @@ -295,8 +295,8 @@ void PayloadDecoderBase::ExitContainer(PayloadEntry & entry) CHIP_ERROR err = mReader.ExitContainer(mNestingEnters[--mCurrentNesting]); if (err != CHIP_NO_ERROR) { - mValueBuilder.AddFormat("ERROR: %" CHIP_ERROR_FORMAT, err.Format()); - mNameBuilder.AddFormat("END CONTAINER"); + mValueBuilder.Reset().AddFormat("ERROR: %" CHIP_ERROR_FORMAT, err.Format()); + mNameBuilder.Reset().AddFormat("END CONTAINER"); entry = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str()); mState = State::kDone; return;