aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2015-06-23 14:06:08 -0700
committerGravatar yang-g <yangg@google.com>2015-06-23 14:06:08 -0700
commit3deb0069f4861451fc174859c293ddafcad648a9 (patch)
treea3eb95e82ec1e23e5fe54fd710a58f64e4130d29 /src/cpp
parent01ac44bf080deb1781f40aac1e74e034ce8adb25 (diff)
Only copy stuff when status is ok
Diffstat (limited to 'src/cpp')
-rw-r--r--src/cpp/server/server.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index 31b6a0ee00..4c44d9ec50 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -368,10 +368,12 @@ Server::GenericAsyncRequest::GenericAsyncRequest(
bool Server::GenericAsyncRequest::FinalizeResult(void** tag, bool* status) {
// TODO(yangg) remove the copy here.
- static_cast<GenericServerContext*>(context_)->method_ = call_details_.method;
- static_cast<GenericServerContext*>(context_)->host_ = call_details_.host;
- gpr_free(call_details_.method);
- gpr_free(call_details_.host);
+ if (*status) {
+ static_cast<GenericServerContext*>(context_)->method_ = call_details_.method;
+ static_cast<GenericServerContext*>(context_)->host_ = call_details_.host;
+ gpr_free(call_details_.method);
+ gpr_free(call_details_.host);
+ }
return BaseAsyncRequest::FinalizeResult(tag, status);
}