diff options
author | Craig Tiller <ctiller@google.com> | 2016-05-18 12:12:21 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-05-18 12:12:21 -0700 |
commit | b30d3d727a7a59b5ac90efa86d3da3000cf6e393 (patch) | |
tree | 11f60af444b8cdea683c71fa3ad6b456ec0e5184 /src/core/lib/security/credentials | |
parent | 32c71e0ede278dff8457f8d65d8f78e2bec07076 (diff) |
Address some memory leaks
Diffstat (limited to 'src/core/lib/security/credentials')
-rw-r--r-- | src/core/lib/security/credentials/credentials.c | 2 | ||||
-rw-r--r-- | src/core/lib/security/credentials/google_default/google_default_credentials.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/core/lib/security/credentials/credentials.c b/src/core/lib/security/credentials/credentials.c index 3dde6e587d..ce31919f74 100644 --- a/src/core/lib/security/credentials/credentials.c +++ b/src/core/lib/security/credentials/credentials.c @@ -58,6 +58,7 @@ grpc_credentials_metadata_request *grpc_credentials_metadata_request_create( void *user_data) { grpc_credentials_metadata_request *r = gpr_malloc(sizeof(grpc_credentials_metadata_request)); + memset(&r->response, 0, sizeof(r->response)); r->creds = grpc_call_credentials_ref(creds); r->cb = cb; r->user_data = user_data; @@ -67,6 +68,7 @@ grpc_credentials_metadata_request *grpc_credentials_metadata_request_create( void grpc_credentials_metadata_request_destroy( grpc_credentials_metadata_request *r) { grpc_call_credentials_unref(r->creds); + grpc_http_response_destroy(&r->response); gpr_free(r); } diff --git a/src/core/lib/security/credentials/google_default/google_default_credentials.c b/src/core/lib/security/credentials/google_default/google_default_credentials.c index 465668476e..778773d6c8 100644 --- a/src/core/lib/security/credentials/google_default/google_default_credentials.c +++ b/src/core/lib/security/credentials/google_default/google_default_credentials.c @@ -113,6 +113,7 @@ static int is_stack_running_on_compute_engine(void) { detector.is_done = 0; detector.success = 0; + memset(&detector.response, 0, sizeof(detector.response)); memset(&request, 0, sizeof(grpc_httpcli_request)); request.host = GRPC_COMPUTE_ENGINE_DETECTION_HOST; request.http.path = "/"; @@ -150,6 +151,7 @@ static int is_stack_running_on_compute_engine(void) { g_polling_mu = NULL; gpr_free(detector.pollset); + grpc_http_response_destroy(&detector.response); return detector.success; } |