From 1d83a701b69e0b29b5ae3b471f724650f3eea241 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Jan 2017 09:35:42 -0800 Subject: [PATCH] Fix memory leak --- src/cpp/client/secure_credentials.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index 7fc315bb38128..25f6bab7f2583 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -214,6 +214,10 @@ void MetadataCredentialsPluginWrapper::InvokePlugin( cb(user_data, md.empty() ? nullptr : &md[0], md.size(), static_cast(status.error_code()), status.error_message().c_str()); + for (auto it = md.begin(); it != md.end(); ++it) { + grpc_slice_unref(it->key); + grpc_slice_unref(it->value); + } } MetadataCredentialsPluginWrapper::MetadataCredentialsPluginWrapper(