php: fix call plugin_get_metadata return value leak

pull/14155/head
Zhouyihai Ding 7 years ago
parent 1d8ab5a916
commit e3e6470db3
  1. 8
      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;

Loading…
Cancel
Save