Skip to content

Commit 0ebcb5e

Browse files
Merge pull request grpc#23567 from HannahShiSFB/23477
PHP: avoid destroy channel more than once
2 parents fa02ab8 + b3d1f2a commit 0ebcb5e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/php/ext/grpc/channel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ extern HashTable grpc_persistent_list;
5050
extern HashTable grpc_target_upper_bound_map;
5151

5252
void free_grpc_channel_wrapper(grpc_channel_wrapper* channel, bool free_channel) {
53-
if (free_channel) {
53+
if (free_channel && channel->wrapped) {
5454
grpc_channel_destroy(channel->wrapped);
5555
channel->wrapped = NULL;
5656
}

src/php/ext/grpc/php_grpc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ void destroy_grpc_channels() {
159159
wrapped_channel.wrapper = le->channel;
160160
grpc_channel_wrapper *channel = wrapped_channel.wrapper;
161161
grpc_channel_destroy(channel->wrapped);
162+
channel->wrapped = NULL;
162163
PHP_GRPC_HASH_FOREACH_END()
163164
}
164165

0 commit comments

Comments
 (0)