From fbeb55cd4e7070791525afb4619d6e8413b3f362 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 26 Apr 2018 18:21:12 +0200 Subject: [PATCH] Fix CID 1164526 (Resource leak in object) stream_ was allocated in the constructor, but the destructor did not free it. Signed-off-by: Stefan Weil --- src/viewer/svutil.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/viewer/svutil.cpp b/src/viewer/svutil.cpp index 3868bc76..99de0958 100644 --- a/src/viewer/svutil.cpp +++ b/src/viewer/svutil.cpp @@ -279,6 +279,8 @@ void SVNetwork::Close() { #else close(stream_); #endif + // Mark stream_ as invalid. + stream_ = -1; } @@ -448,6 +450,7 @@ SVNetwork::SVNetwork(const char* hostname, int port) { } SVNetwork::~SVNetwork() { + Close(); delete[] msg_buffer_in_; } -- GitLab