iSulad/0216-bugfix-for-null-pointer-reference.patch

58 lines
1.7 KiB
Diff
Raw Permalink Normal View History

2024-10-18 10:47:42 +08:00
From f79686748aff486ddb17d6044854f899c86fb93e Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Tue, 18 Jun 2024 16:02:25 +0800
Subject: [PATCH 216/226] bugfix for null pointer reference
Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
src/daemon/entry/connect/grpc/grpc_service.cc | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/daemon/entry/connect/grpc/grpc_service.cc b/src/daemon/entry/connect/grpc/grpc_service.cc
index e37117ae..07309235 100644
--- a/src/daemon/entry/connect/grpc/grpc_service.cc
+++ b/src/daemon/entry/connect/grpc/grpc_service.cc
@@ -94,14 +94,20 @@ public:
{
// Wait for the server to shutdown. Note that some other thread must be
// responsible for shutting down the server for this call to ever return.
- m_server->Wait();
+ if (m_server != nullptr) {
+ m_server->Wait();
+ }
+
m_runtimeRuntimeService.Wait();
}
void Shutdown(void)
{
- m_server->Shutdown();
+ if (m_server != nullptr) {
+ m_server->Shutdown();
+ }
m_runtimeRuntimeService.Shutdown();
+
// Shutdown daemon, this operation should remove socket file.
for (const auto &address : m_socketPath) {
if (address.find(UNIX_SOCKET_PREFIX) == 0) {
@@ -241,10 +247,16 @@ int grpc_server_init(const struct service_arguments *args)
void grpc_server_wait(void)
{
+ if (g_grpcserver == nullptr) {
+ return;
+ }
g_grpcserver->Wait();
}
void grpc_server_shutdown(void)
{
+ if (g_grpcserver == nullptr) {
+ return;
+ }
g_grpcserver->Shutdown();
}
--
2.33.0