From 9e2be4998e453ef66a595b230519a006ca257529 Mon Sep 17 00:00:00 2001 From: ncteisen Date: Wed, 15 Nov 2017 23:52:55 -0800 Subject: Only alloc if status <> ok --- src/core/lib/transport/error_utils.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/core/lib/transport/error_utils.cc b/src/core/lib/transport/error_utils.cc index bcaedeeac9..723663a6d7 100644 --- a/src/core/lib/transport/error_utils.cc +++ b/src/core/lib/transport/error_utils.cc @@ -44,10 +44,6 @@ void grpc_error_get_status(grpc_exec_ctx* exec_ctx, grpc_error* error, grpc_millis deadline, grpc_status_code* code, grpc_slice* slice, grpc_http2_error_code* http_error, const char** full_error_details) { - if (full_error_details != NULL) { - *full_error_details = gpr_strdup(grpc_error_string(error)); - } - // Start with the parent error and recurse through the tree of children // until we find the first one that has a status code. grpc_error* found_error = @@ -74,6 +70,10 @@ void grpc_error_get_status(grpc_exec_ctx* exec_ctx, grpc_error* error, } if (code != nullptr) *code = status; + if (full_error_details != NULL && status != GRPC_STATUS_OK) { + *full_error_details = gpr_strdup(grpc_error_string(error)); + } + if (http_error != nullptr) { if (grpc_error_get_int(found_error, GRPC_ERROR_INT_HTTP2_ERROR, &integer)) { *http_error = (grpc_http2_error_code)integer; -- cgit v1.2.3