pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] hrsakai commented on a change in pull request #2814: Fix memory issue in cpp ZTSClient
Date Tue, 23 Oct 2018 02:37:11 GMT
hrsakai commented on a change in pull request #2814: Fix memory issue in cpp ZTSClient
URL: https://github.com/apache/pulsar/pull/2814#discussion_r227203601
 
 

 ##########
 File path: pulsar-client-cpp/lib/auth/athenz/ZTSClient.cc
 ##########
 @@ -143,7 +143,7 @@ std::string ZTSClient::ybase64Encode(const unsigned char *input, int
length) {
 char *ZTSClient::base64Decode(const char *input) {
     BIO *bio, *b64;
     size_t length = strlen(input);
-    char *result = (char *)malloc(length);
+    char *result = (char *)calloc(length, sizeof(char));
 
 Review comment:
   This function is called once when client connects to broker.
   if reconnection occurs, this function will not be called for 3600m from the previous connection
because RoleToken fetched using this privatekey will be cached for 3600m(default).
   So this method is not called frequently.
   
   Sorry, already null terminated string is set to `result[strlen(result)]`.
    but, I'd like to initialize memory.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message