浏览代码

PHP: fix windows compilation issue

Stanley Cheung 8 年之前
父节点
当前提交
d2484761d4
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/php/ext/grpc/channel_credentials.c

+ 2 - 1
src/php/ext/grpc/channel_credentials.c

@@ -165,7 +165,7 @@ PHP_METHOD(ChannelCredentials, createSsl) {
   }
   }
 
 
   php_grpc_int hashkey_len = root_certs_length + cert_chain_length;
   php_grpc_int hashkey_len = root_certs_length + cert_chain_length;
-  char hashkey[hashkey_len];
+  char *hashkey = emalloc(hashkey_len);
   if (root_certs_length > 0) {
   if (root_certs_length > 0) {
     strcpy(hashkey, pem_root_certs);
     strcpy(hashkey, pem_root_certs);
   }
   }
@@ -181,6 +181,7 @@ PHP_METHOD(ChannelCredentials, createSsl) {
       pem_key_cert_pair.private_key == NULL ? NULL : &pem_key_cert_pair, NULL);
       pem_key_cert_pair.private_key == NULL ? NULL : &pem_key_cert_pair, NULL);
   zval *creds_object = grpc_php_wrap_channel_credentials(creds, hashstr, false
   zval *creds_object = grpc_php_wrap_channel_credentials(creds, hashstr, false
                                                          TSRMLS_CC);
                                                          TSRMLS_CC);
+  efree(hashkey);
   RETURN_DESTROY_ZVAL(creds_object);
   RETURN_DESTROY_ZVAL(creds_object);
 }
 }