From f820a5ea1c5c9f6fc414c214a1df4c71fa6d3cb6 Mon Sep 17 00:00:00 2001 From: Steve Anton Date: Fri, 10 Aug 2018 10:22:52 -0700 Subject: [PATCH] Fix use after move in SafeSetError There is not actually any noticeable bug with the code as it was since the RTCError move operators don't reset the type of the moved object. But the clang static analyzer complains about this and it's bad practice. Bug: webrtc:9593 Change-Id: I8c04f193d10733371e0125c5349f9798f916eecf Reviewed-on: https://webrtc-review.googlesource.com/93500 Reviewed-by: Seth Hampson Commit-Queue: Steve Anton Cr-Commit-Position: refs/heads/master@{#24266} --- pc/peerconnection.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc index 5337fae2a4..dd3278d27e 100644 --- a/pc/peerconnection.cc +++ b/pc/peerconnection.cc @@ -237,10 +237,11 @@ bool SafeSetError(webrtc::RTCErrorType type, webrtc::RTCError* error) { } bool SafeSetError(webrtc::RTCError error, webrtc::RTCError* error_out) { + bool ok = error.ok(); if (error_out) { *error_out = std::move(error); } - return error.ok(); + return ok; } std::string GetSignalingStateString(