]> git.mxchange.org Git - flightgear.git/commitdiff
fix leaks; make destructors virtual
authormfranz <mfranz>
Wed, 6 May 2009 18:55:20 +0000 (18:55 +0000)
committerTim Moore <timoore@redhat.com>
Mon, 18 May 2009 10:24:16 +0000 (12:24 +0200)
src/ATCDCL/ATCVoice.cxx
src/GUI/dialog.hxx
src/GUI/gui_funcs.cxx
src/Input/fgjs.cxx
src/Instrumentation/od_gauge.hxx

index 682cd24a4ed72b4f70e321f26c05a8ef191686df..e4b05b75c0ff93cdd47f0989e47d08494ca18119 100644 (file)
@@ -151,6 +151,7 @@ unsigned char* FGATCVoice::WriteMessage(char* message, int& len, bool& dataOK) {
        // Check for no tokens found else slScheduler can be crashed
        if(!word) {
                dataOK = false;
+               delete[] wdptr;
                return(NULL);
        }
 
@@ -170,6 +171,8 @@ unsigned char* FGATCVoice::WriteMessage(char* message, int& len, bool& dataOK) {
                        SG_LOG(SG_ATC, SG_ALERT, "Offset + length: " << wdptr[i].offset + wdptr[i].length
                             << " exceeds rawdata size: " << rawDataSize << endl);
                        delete[] wdptr;
+                       delete[] tmpbuf;
+                       delete[] outbuf;
                        dataOK = false;
                        return(NULL);
                }
index fcd1ca7d3159610f78cfe0287692792ad2077cfd..749c355cbdd6f215e75e7b5441e95cac783016db 100644 (file)
@@ -21,7 +21,7 @@ using std::vector;
 #define FGCLASS_LIST          0x00000001
 #define FGCLASS_AIRPORTLIST   0x00000002
 #define FGCLASS_PROPERTYLIST  0x00000004
-class GUI_ID { public: GUI_ID(int id) : id(id) {} int id; };
+class GUI_ID { public: GUI_ID(int id) : id(id) {} virtual ~GUI_ID() {} int id; };
 
 
 
index 5746111963097196a445ec44a4093d525bfbafce..1dc5db7a4df931cd9d335e11a72fd1e4f141c618 100644 (file)
@@ -246,6 +246,7 @@ void fgHiResDump()
     /* allocate buffer large enough to store one tile */
     GLubyte *tile = (GLubyte *)malloc(width * height * 3 * sizeof(GLubyte));
     if (!tile) {
+        delete [] filename;
         printf("Malloc of tile buffer failed!\n");
         return;
     }
@@ -257,6 +258,7 @@ void fgHiResDump()
     GLubyte *buffer
         = (GLubyte *)malloc(imageWidth * height * 3 * sizeof(GLubyte));
     if (!buffer) {
+        delete [] filename;
         free(tile);
         printf("Malloc of tile row buffer failed!\n");
         return;
@@ -283,6 +285,7 @@ void fgHiResDump()
     f = fopen(filename, "wb");
     if (!f) {
         printf("Couldn't open image file: %s\n", filename);
+        delete [] filename;
         free(buffer);
         free(tile);
         return;
index 81c4cdda0c6fd1e25ad11002325662ddebda2c3e..5527514d5d49c1098ce62963dd93dd18d27d0422 100644 (file)
@@ -211,6 +211,7 @@ int main( int argc, char *argv[] ) {
     delete jsi;
     delete[] xfs;
     delete jss;
+    delete[] jstree;
 
     return 1;
 }
index 2c957d42977fcf06f88471240a8a67d97de4ca0f..3b3217d5b7b4d80ee5f30b6b9808f585b8e72e9c 100644 (file)
@@ -38,7 +38,7 @@ class FGODGauge : public SGSubsystem {
 public:
     FGODGauge ( SGPropertyNode *node );
     FGODGauge();
-    ~FGODGauge();
+    virtual ~FGODGauge();
     virtual void init ();
     virtual void update (double dt);