Fixed memory leak

This commit is contained in:
llsth 2015-04-08 00:41:24 +02:00
parent 2c2671df31
commit e45fae685c
6 changed files with 4 additions and 11 deletions

View File

@ -53,7 +53,7 @@ char* Language::UntagText(const char* text)
} }
unsigned int count = sizeof(texttags) / sizeof(texttag); unsigned int count = sizeof(texttags) / sizeof(texttag);
char *untagged = new char[StrLen(text)]; char *untagged = new char[StrLen(text) * 2];
Untag(untagged, text, (texttag*)texttags, count); Untag(untagged, text, (texttag*)texttags, count);
unsigned int len = StrLen(untagged) + 1; unsigned int len = StrLen(untagged) + 1;

View File

@ -44,6 +44,7 @@ PreferencesBase::PreferencesBase()
PreferencesBase::~PreferencesBase() PreferencesBase::~PreferencesBase()
{ {
delete buf; delete buf;
delete prompt;
} }
void PreferencesBase::SetDefaults() void PreferencesBase::SetDefaults()

View File

@ -52,7 +52,6 @@ AmigaProgram::AmigaProgram()
{ {
rdargs = NULL; rdargs = NULL;
args.shell = FALSE; args.shell = FALSE;
args.quiet = FALSE;
args.input = NULL; args.input = NULL;
Console = NULL; Console = NULL;
} }
@ -75,17 +74,12 @@ void AmigaProgram::Initialize(int argc, char **argv)
return; return;
} }
// rdargs = (RDArgs*)ReadArgs((const char*)ARGS_FORMAT, (IPTR*)&args, 0); rdargs = (RDArgs*)ReadArgs((const char*)ARGS_FORMAT, (IPTR)&args, 0);
rdargs = (RDArgs*)ReadArgs((const char*)ARGS_FORMAT, (IPTR*)&args, 0);
if (!rdargs) if (!rdargs)
{ {
PrintFault(IoErr(), (STRPTR)argv[0]); PrintFault(IoErr(), (STRPTR)argv[0]);
} }
if (!args.quiet) {
//TODO
}
if (args.shell) { if (args.shell) {
Console = new AmigaShellConsole(Preferences->GetPrompt()); Console = new AmigaShellConsole(Preferences->GetPrompt());
return; return;

View File

@ -30,7 +30,6 @@ struct RDArgs;
struct amathargs { struct amathargs {
long shell; long shell;
long quiet;
char *input; char *input;
}; };

View File

@ -39,7 +39,6 @@
StandardProgram::StandardProgram() StandardProgram::StandardProgram()
: Program() : Program()
{ {
Graphs = NOMEM;
Console = NOMEM; Console = NOMEM;
} }

View File

@ -109,7 +109,7 @@ typedef u_int8_t uint8_t;
typedef u_int16_t uint16_t; typedef u_int16_t uint16_t;
typedef u_int32_t uint32_t; typedef u_int32_t uint32_t;
typedef u_int64_t uint64_t; typedef u_int64_t uint64_t;
# define IPTR LONG # define IPTR LONG*
#endif #endif
#endif #endif