From 759e37558ffae5959a9207b875bc1079665458bd Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Mon, 16 Sep 2024 17:32:11 +0200 Subject: [PATCH] Fix memory leak --- .../cavallium/rockserver/core/server/GrpcServer.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/it/cavallium/rockserver/core/server/GrpcServer.java b/src/main/java/it/cavallium/rockserver/core/server/GrpcServer.java index c64402c..6438696 100644 --- a/src/main/java/it/cavallium/rockserver/core/server/GrpcServer.java +++ b/src/main/java/it/cavallium/rockserver/core/server/GrpcServer.java @@ -467,10 +467,12 @@ public class GrpcServer extends Server { } private static void closeArenaSafe(Arena autoArena) { - try { - autoArena.close(); - } catch (Exception ex2) { - LOG.error("Failed to close arena", ex2); + if (autoArena != null) { + try { + autoArena.close(); + } catch (Exception ex2) { + LOG.error("Failed to close arena", ex2); + } } }