From 2afe4c52c897e672b9f09532094232011a2684b9 Mon Sep 17 00:00:00 2001 From: Murai Takashi Date: Sun, 26 Jan 2020 20:16:01 +0900 Subject: [PATCH] appserver: Fix PVS V595 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add NULL check for fAllocator, since it might return NULL. Change-Id: Ifb72266b4d4c5f076f0c663066dc9b81e94fc201 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2162 Reviewed-by: Stephan Aßmus --- src/servers/app/ClientMemoryAllocator.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/servers/app/ClientMemoryAllocator.cpp b/src/servers/app/ClientMemoryAllocator.cpp index 746f12cfd9..cb07609bc3 100644 --- a/src/servers/app/ClientMemoryAllocator.cpp +++ b/src/servers/app/ClientMemoryAllocator.cpp @@ -324,10 +324,11 @@ ClientMemory::ClientMemory() ClientMemory::~ClientMemory() { - if (fBlock != NULL) - fAllocator->Free(fBlock); - if (fAllocator != NULL) + if (fAllocator != NULL) { + if (fBlock != NULL) + fAllocator->Free(fBlock); fAllocator->ReleaseReference(); + } }