From c31c54c1b65080b7e68942e8b50dc88b5ce1279b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 27 Dec 2017 12:54:30 +0100 Subject: Loop.cpp: delete passed object prior to overwriting it --- nxcomp/src/Loop.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'nxcomp') diff --git a/nxcomp/src/Loop.cpp b/nxcomp/src/Loop.cpp index fa8ba9a1e..e84896e36 100644 --- a/nxcomp/src/Loop.cpp +++ b/nxcomp/src/Loop.cpp @@ -3141,6 +3141,9 @@ int InitBeforeNegotiation() // Get ready to open the local display. // + delete xServerAddr; + xServerAddr = NULL; + SetupDisplaySocket(xServerAddrFamily, xServerAddr, xServerAddrLength); } @@ -3780,13 +3783,13 @@ void SetupUnixSocket() // The following is a dumb copy-paste. The // nxcompsh library should offer a better // implementation. +// addr is assumed to have been freed outside // void SetupDisplaySocket(int &addr_family, sockaddr *&addr, unsigned int &addr_length) { addr_family = AF_INET; - addr = NULL; addr_length = 0; char *display; -- cgit v1.2.3