]> git.mxchange.org Git - simgear.git/commitdiff
fix leaks
authormfranz <mfranz>
Wed, 6 May 2009 06:32:09 +0000 (06:32 +0000)
committerTim Moore <timoore@redhat.com>
Sat, 16 May 2009 14:17:39 +0000 (16:17 +0200)
simgear/io/tcp_server.cxx
simgear/screen/screen-dump.cxx
simgear/timing/sg_time.cxx

index 01c949da5e33aea9e978f39438b5d3a1c2d4f6b9..f0f278662e60c0ae4aed13650ef1b7642c5529f1 100644 (file)
@@ -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()
 {
index b74f06c0592732601968c687c90e3d9d53be47b3..dc5ba7bd56eb0c9310ceb620b5b0e4c8db5bb7ea 100644 (file)
@@ -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;
     }
index 66f4b16e93da0da6d06c707bdd1932a0ff4f4a63..45fd41c1488ce08e2dca0c37906e53368bcfa255 100644 (file)
@@ -122,11 +122,7 @@ SGTime::SGTime() {
 
 SGTime::~SGTime()
 {
-    if ( tzContainer != NULL ) {
-        SGTimeZoneContainer *tmp = tzContainer;
-        tzContainer = NULL;
-       delete tmp;
-    }
+    delete tzContainer;
 }