Merge pull request #18445 from nicolasnoble/last-memset-for-real-this-time

Taking care of a last few memsets.
pull/18635/head
Nicolas Noble 6 years ago committed by GitHub
commit cb01297021
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/core/ext/filters/client_channel/health/health_check_client.cc
  2. 1
      src/core/lib/security/credentials/google_default/google_default_credentials.cc
  3. 16
      src/core/lib/transport/transport.cc

@ -349,7 +349,6 @@ void HealthCheckClient::CallState::StartCall() {
return;
}
// Initialize payload and batch.
memset(&batch_, 0, sizeof(batch_));
payload_.context = context_;
batch_.payload = &payload_;
// on_complete callback takes ref, handled manually.
@ -401,8 +400,6 @@ void HealthCheckClient::CallState::StartCall() {
// Start batch.
StartBatch(&batch_);
// Initialize recv_trailing_metadata batch.
memset(&recv_trailing_metadata_batch_, 0,
sizeof(recv_trailing_metadata_batch_));
recv_trailing_metadata_batch_.payload = &payload_;
// Add recv_trailing_metadata op.
grpc_metadata_batch_init(&recv_trailing_metadata_);
@ -507,7 +504,6 @@ void HealthCheckClient::CallState::DoneReadingRecvMessage(grpc_error* error) {
// This re-uses the ref we're holding.
// Note: Can't just reuse batch_ here, since we don't know that all
// callbacks from the original batch have completed yet.
memset(&recv_message_batch_, 0, sizeof(recv_message_batch_));
recv_message_batch_.payload = &payload_;
payload_.recv_message.recv_message = &recv_message_;
payload_.recv_message.recv_message_ready = GRPC_CLOSURE_INIT(

@ -172,7 +172,6 @@ static int is_metadata_server_reachable() {
detector.pollent = grpc_polling_entity_create_from_pollset(pollset);
detector.is_done = 0;
detector.success = 0;
memset(&detector.response, 0, sizeof(detector.response));
memset(&request, 0, sizeof(grpc_httpcli_request));
request.host = (char*)GRPC_COMPUTE_ENGINE_DETECTION_HOST;
request.http.path = (char*)"/";

@ -29,6 +29,7 @@
#include "src/core/lib/gpr/alloc.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/slice/slice_internal.h"
@ -243,25 +244,26 @@ void grpc_transport_stream_op_batch_finish_with_failure(
GRPC_ERROR_UNREF(error);
}
typedef struct {
struct made_transport_op {
grpc_closure outer_on_complete;
grpc_closure* inner_on_complete;
grpc_closure* inner_on_complete = nullptr;
grpc_transport_op op;
} made_transport_op;
made_transport_op() {
memset(&outer_on_complete, 0, sizeof(outer_on_complete));
}
};
static void destroy_made_transport_op(void* arg, grpc_error* error) {
made_transport_op* op = static_cast<made_transport_op*>(arg);
GRPC_CLOSURE_SCHED(op->inner_on_complete, GRPC_ERROR_REF(error));
gpr_free(op);
grpc_core::Delete<made_transport_op>(op);
}
grpc_transport_op* grpc_make_transport_op(grpc_closure* on_complete) {
made_transport_op* op =
static_cast<made_transport_op*>(gpr_malloc(sizeof(*op)));
made_transport_op* op = grpc_core::New<made_transport_op>();
GRPC_CLOSURE_INIT(&op->outer_on_complete, destroy_made_transport_op, op,
grpc_schedule_on_exec_ctx);
op->inner_on_complete = on_complete;
memset(&op->op, 0, sizeof(op->op));
op->op.on_consumed = &op->outer_on_complete;
return &op->op;
}

Loading…
Cancel
Save