diff options
author | 2018-01-23 20:48:18 -0800 | |
---|---|---|
committer | 2018-01-23 20:48:18 -0800 | |
commit | e3e6470db38514ca559caf150f707ceee4c8d934 (patch) | |
tree | d3a8ff740a7de818a5f394d20c8b5f5dcf1d9e1d /src/php | |
parent | 1d8ab5a9165717b93255336b6d1b25174f7d998c (diff) |
php: fix call plugin_get_metadata return value leak
Diffstat (limited to 'src/php')
-rw-r--r-- | src/php/ext/grpc/call_credentials.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/php/ext/grpc/call_credentials.c b/src/php/ext/grpc/call_credentials.c index a395d53614..ba3ba9a525 100644 --- a/src/php/ext/grpc/call_credentials.c +++ b/src/php/ext/grpc/call_credentials.c @@ -183,15 +183,16 @@ int plugin_get_metadata( *status = GRPC_STATUS_OK; *error_details = NULL; + bool should_return = false; grpc_metadata_array metadata; if (retval == NULL || Z_TYPE_P(retval) != IS_ARRAY) { *status = GRPC_STATUS_INVALID_ARGUMENT; - return true; // Synchronous return. + should_return = true; // Synchronous return. } if (!create_metadata_array(retval, &metadata)) { *status = GRPC_STATUS_INVALID_ARGUMENT; - return true; // Synchronous return. + should_return = true; // Synchronous return. } if (retval != NULL) { @@ -204,6 +205,9 @@ int plugin_get_metadata( PHP_GRPC_FREE_STD_ZVAL(retval); #endif } + if (should_return) { + return true; + } if (metadata.count > GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX) { *status = GRPC_STATUS_INTERNAL; |