From: mfranz Date: Wed, 6 May 2009 06:32:09 +0000 (+0000) Subject: fix leaks X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1ccaf3a0bd494085b656279082c4576f302002c7;p=simgear.git fix leaks --- diff --git a/simgear/io/tcp_server.cxx b/simgear/io/tcp_server.cxx index 01c949da..f0f27866 100644 --- a/simgear/io/tcp_server.cxx +++ b/simgear/io/tcp_server.cxx @@ -12,6 +12,7 @@ class TcpServer { public: TcpServer(); + ~TcpServer(); bool open(); bool process(); bool close(); @@ -25,6 +26,11 @@ TcpServer::TcpServer() channel = new SGSocket( "", "5500", "tcp" ); } +TcpServer::~Tcpserver() +{ + delete channel; +} + bool TcpServer::open() { diff --git a/simgear/screen/screen-dump.cxx b/simgear/screen/screen-dump.cxx index b74f06c0..dc5ba7bd 100644 --- a/simgear/screen/screen-dump.cxx +++ b/simgear/screen/screen-dump.cxx @@ -55,6 +55,7 @@ bool sg_glWritePPMFile(const char *filename, GLubyte *buffer, int win_width, int ibuffer = (unsigned char *) malloc(win_width*win_height*RGB3); if ( (fp = fopen(filename, "wb")) == NULL ) { + free(ibuffer); printf("Warning: cannot open %s\n", filename); return false; } diff --git a/simgear/timing/sg_time.cxx b/simgear/timing/sg_time.cxx index 66f4b16e..45fd41c1 100644 --- a/simgear/timing/sg_time.cxx +++ b/simgear/timing/sg_time.cxx @@ -122,11 +122,7 @@ SGTime::SGTime() { SGTime::~SGTime() { - if ( tzContainer != NULL ) { - SGTimeZoneContainer *tmp = tzContainer; - tzContainer = NULL; - delete tmp; - } + delete tzContainer; }