Skip to content

Commit

Permalink
fix memory leak of grpc_resource_user_quota
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisse74 committed Mar 2, 2020
1 parent 5b9b5eb commit 27aadc0
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/core/lib/surface/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1352,13 +1352,6 @@ void grpc_server_shutdown_and_notify(grpc_server* server,

channel_broadcaster_shutdown(&broadcaster, true /* send_goaway */,
GRPC_ERROR_NONE);

if (server->default_resource_user != nullptr) {
grpc_resource_quota_unref(
grpc_resource_user_quota(server->default_resource_user));
grpc_resource_user_shutdown(server->default_resource_user);
grpc_resource_user_unref(server->default_resource_user);
}
}

void grpc_server_cancel_all_calls(grpc_server* server) {
Expand Down Expand Up @@ -1396,6 +1389,12 @@ void grpc_server_destroy(grpc_server* server) {

gpr_mu_unlock(&server->mu_global);

if (server->default_resource_user != nullptr) {
grpc_resource_quota_unref(
grpc_resource_user_quota(server->default_resource_user));
grpc_resource_user_shutdown(server->default_resource_user);
grpc_resource_user_unref(server->default_resource_user);
}
server_unref(server);
}

Expand Down

0 comments on commit 27aadc0

Please sign in to comment.