1
0
Fork 0

fix leaks; make destructors virtual

This commit is contained in:
mfranz 2009-05-06 18:55:20 +00:00 committed by Tim Moore
parent 3c138c8345
commit 744a23d0aa
5 changed files with 9 additions and 2 deletions

View 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);
}

View 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; };

View 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;

View file

@ -211,6 +211,7 @@ int main( int argc, char *argv[] ) {
delete jsi;
delete[] xfs;
delete jss;
delete[] jstree;
return 1;
}

View 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);