Browse Source

Fix two memory leaks and update a link in the README. (#501)

Fixes #340.
Daniel Alm 6 years ago
parent
commit
7c9a83c424
2 changed files with 3 additions and 1 deletions
  1. 1 1
      Examples/Google/NaturalLanguage/README.md
  2. 2 0
      Sources/CgRPC/shim/channel_shim.c

+ 1 - 1
Examples/Google/NaturalLanguage/README.md

@@ -1,7 +1,7 @@
 # Calling the Google Cloud Natural Language API
 # Calling the Google Cloud Natural Language API
 
 
 This directory contains a very simple sample that calls the 
 This directory contains a very simple sample that calls the 
-[Google Cloud Natural Language API](https://cloud.google.com/datastore/docs/reference/rpc/google.datastore.v1).
+[Google Cloud Natural Language API](https://cloud.google.com/natural-language/docs/reference/rpc/google.cloud.language.v1).
 Calls are made directly to the Cloud Natural Language RPC interface. 
 Calls are made directly to the Cloud Natural Language RPC interface. 
 In practice, these would be wrapped in idiomatic code.
 In practice, these would be wrapped in idiomatic code.
 
 

+ 2 - 0
Sources/CgRPC/shim/channel_shim.c

@@ -56,6 +56,7 @@ cgrpc_channel *cgrpc_channel_create_secure(const char *address,
   grpc_channel_credentials *creds = grpc_ssl_credentials_create(pem_root_certs, client_credentials_pointer, NULL, NULL);
   grpc_channel_credentials *creds = grpc_ssl_credentials_create(pem_root_certs, client_credentials_pointer, NULL, NULL);
 
 
   c->channel = grpc_secure_channel_create(creds, address, &channel_args, NULL);
   c->channel = grpc_secure_channel_create(creds, address, &channel_args, NULL);
+  grpc_channel_credentials_release(creds);
   c->completion_queue = grpc_completion_queue_create_for_next(NULL);
   c->completion_queue = grpc_completion_queue_create_for_next(NULL);
   return c;
   return c;
 }
 }
@@ -72,6 +73,7 @@ cgrpc_channel *cgrpc_channel_create_google(const char *address,
   grpc_channel_credentials *google_creds = grpc_google_default_credentials_create();
   grpc_channel_credentials *google_creds = grpc_google_default_credentials_create();
 
 
   c->channel = grpc_secure_channel_create(google_creds, address, &channel_args, NULL);
   c->channel = grpc_secure_channel_create(google_creds, address, &channel_args, NULL);
+  grpc_channel_credentials_release(google_creds);
   c->completion_queue = grpc_completion_queue_create_for_next(NULL);
   c->completion_queue = grpc_completion_queue_create_for_next(NULL);
   return c;
   return c;
 }
 }