From 246a99510bc3836d605a5974d1f4e4e69e838bf5 Mon Sep 17 00:00:00 2001 From: Bright Chen Date: Sun, 28 Jul 2024 19:18:52 +0800 Subject: [PATCH] Fix baidu master service leak --- src/brpc/server.cpp | 3 +++ src/brpc/server.h | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/brpc/server.cpp b/src/brpc/server.cpp index 399f348d7f..00cdec79af 100644 --- a/src/brpc/server.cpp +++ b/src/brpc/server.cpp @@ -443,6 +443,9 @@ Server::~Server() { _options.thrift_service = NULL; #endif + delete _options.baidu_master_service; + _options.baidu_master_service = NULL; + delete _options.http_master_service; _options.http_master_service = NULL; diff --git a/src/brpc/server.h b/src/brpc/server.h index c9459c239d..fdcba68f77 100644 --- a/src/brpc/server.h +++ b/src/brpc/server.h @@ -226,6 +226,13 @@ struct ServerOptions { // Default: false bool use_rdma; + // [CAUTION] This option is for implementing specialized baidu-std proxies, + // most users don't need it. Don't change this option unless you fully + // understand the description below. + // If this option is set, all baidu-std requests to the server will be delegated + // to this service. + // + // Owned by Server and deleted in server's destructor. BaiduMasterService* baidu_master_service; // [CAUTION] This option is for implementing specialized http proxies,