Fix memory allocation bug; stricter check for command line options.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@419 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-01-13 15:08:18 +00:00
parent 9c142e223b
commit 24c3237e6a
4 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,14 @@
2000-01-13 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/lyx_main.C (easyParse): output an error and exit if an
incorrect command line option has been given.
* src/spellchecker.C (ispell_check_word): document a memory leak.
* src/bufferlist.C (write): fix mismatched allocation/deletion,
where a "struct utimbuf" is allocated with "new" and deleted with
"delete[]".
2000-01-12 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* config/lyxinclude.m4 (LYX_FUNC_PUTENV_ARGTYPE): fix the macro,

View File

@ -195,7 +195,7 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
lyxerr << "LyX was not able to make "
"backupcopy. Beware." << endl;
}
delete[] times;
delete times;
}
}

View File

@ -476,6 +476,7 @@ bool LyX::easyParse(int * argc, char * argv[])
bool gui = true;
for(int i = 1; i < *argc; ++i) {
string arg = argv[i];
// Check for -dbg int
if (arg == "-dbg") {
if (i + 1 < *argc) {
@ -568,6 +569,11 @@ bool LyX::easyParse(int * argc, char * argv[])
"ps...] after ")
<< arg << _(" switch!") << endl;
}
else if((!arg.empty()) && (arg[0] == '-')) {
lyxerr << "Illegal option `" << arg << "'" <<endl;
exit(1);
}
}
return gui;
}

View File

@ -437,6 +437,9 @@ isp_result *ispell_check_word(char *word)
{
result->flag = ISP_MISSED;
result->str = buf;
// nb is leaked! where should it be freed? I have to
// admit I do not understand the intent of the code :(
// (JMarc)
char * nb = new char[result->str.length() + 1];
result->str.copy(nb, result->str.length());
nb[result->str.length()]= '\0';