fix leaks; make destructors virtual
This commit is contained in:
parent
3c138c8345
commit
744a23d0aa
5 changed files with 9 additions and 2 deletions
|
@ -151,6 +151,7 @@ unsigned char* FGATCVoice::WriteMessage(char* message, int& len, bool& dataOK) {
|
||||||
// Check for no tokens found else slScheduler can be crashed
|
// Check for no tokens found else slScheduler can be crashed
|
||||||
if(!word) {
|
if(!word) {
|
||||||
dataOK = false;
|
dataOK = false;
|
||||||
|
delete[] wdptr;
|
||||||
return(NULL);
|
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
|
SG_LOG(SG_ATC, SG_ALERT, "Offset + length: " << wdptr[i].offset + wdptr[i].length
|
||||||
<< " exceeds rawdata size: " << rawDataSize << endl);
|
<< " exceeds rawdata size: " << rawDataSize << endl);
|
||||||
delete[] wdptr;
|
delete[] wdptr;
|
||||||
|
delete[] tmpbuf;
|
||||||
|
delete[] outbuf;
|
||||||
dataOK = false;
|
dataOK = false;
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ using std::vector;
|
||||||
#define FGCLASS_LIST 0x00000001
|
#define FGCLASS_LIST 0x00000001
|
||||||
#define FGCLASS_AIRPORTLIST 0x00000002
|
#define FGCLASS_AIRPORTLIST 0x00000002
|
||||||
#define FGCLASS_PROPERTYLIST 0x00000004
|
#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; };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -246,6 +246,7 @@ void fgHiResDump()
|
||||||
/* allocate buffer large enough to store one tile */
|
/* allocate buffer large enough to store one tile */
|
||||||
GLubyte *tile = (GLubyte *)malloc(width * height * 3 * sizeof(GLubyte));
|
GLubyte *tile = (GLubyte *)malloc(width * height * 3 * sizeof(GLubyte));
|
||||||
if (!tile) {
|
if (!tile) {
|
||||||
|
delete [] filename;
|
||||||
printf("Malloc of tile buffer failed!\n");
|
printf("Malloc of tile buffer failed!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -257,6 +258,7 @@ void fgHiResDump()
|
||||||
GLubyte *buffer
|
GLubyte *buffer
|
||||||
= (GLubyte *)malloc(imageWidth * height * 3 * sizeof(GLubyte));
|
= (GLubyte *)malloc(imageWidth * height * 3 * sizeof(GLubyte));
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
|
delete [] filename;
|
||||||
free(tile);
|
free(tile);
|
||||||
printf("Malloc of tile row buffer failed!\n");
|
printf("Malloc of tile row buffer failed!\n");
|
||||||
return;
|
return;
|
||||||
|
@ -283,6 +285,7 @@ void fgHiResDump()
|
||||||
f = fopen(filename, "wb");
|
f = fopen(filename, "wb");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
printf("Couldn't open image file: %s\n", filename);
|
printf("Couldn't open image file: %s\n", filename);
|
||||||
|
delete [] filename;
|
||||||
free(buffer);
|
free(buffer);
|
||||||
free(tile);
|
free(tile);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -211,6 +211,7 @@ int main( int argc, char *argv[] ) {
|
||||||
delete jsi;
|
delete jsi;
|
||||||
delete[] xfs;
|
delete[] xfs;
|
||||||
delete jss;
|
delete jss;
|
||||||
|
delete[] jstree;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class FGODGauge : public SGSubsystem {
|
||||||
public:
|
public:
|
||||||
FGODGauge ( SGPropertyNode *node );
|
FGODGauge ( SGPropertyNode *node );
|
||||||
FGODGauge();
|
FGODGauge();
|
||||||
~FGODGauge();
|
virtual ~FGODGauge();
|
||||||
virtual void init ();
|
virtual void init ();
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue