]> git.lyx.org Git - features.git/commitdiff
Fix memory allocation bug; stricter check for command line options.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 13 Jan 2000 15:08:18 +0000 (15:08 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 13 Jan 2000 15:08:18 +0000 (15:08 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@419 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/bufferlist.C
src/lyx_main.C
src/spellchecker.C

index adebad3a05fa1fd87a39d94a8fa94f0f99155637..c00b66e86f2342a4f78ca339b2fbc2837c5f20da 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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,
index 877568e62036910fa9d98fb0fd79c210a882a052..9f949a381851492c375bd6d885362be69b7caf7d 100644 (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;
                }
        }
        
index a0a482e1310c035285c1138b1416f03510ba2c87..18329f8de2ee85025594d1c3807d7982198c3fe0 100644 (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;
 }
index 4c0104775470f146fdaa228d39a435be936146b4..d6e6ace9e6ade3d83394c98e5ca3cb71df5a2fbc 100644 (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';