Skip to content

Commit

Permalink
fix use after move
Browse files Browse the repository at this point in the history
instead of calling append(), just construct a new string.

Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Jan 9, 2024
1 parent 224085c commit 002da8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/pipebackend/coprocess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void CoProcess::receive(string& received)

if (eolPos != received.size() - 1) {
/* we have some data remaining after the first '\n', let's keep it for later */
d_remaining.append(received, eolPos + 1, received.size() - eolPos - 1);
d_remaining = std::string(received, eolPos + 1, received.size() - eolPos - 1);
}

received.resize(eolPos);
Expand Down

0 comments on commit 002da8e

Please sign in to comment.