[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kate/part
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2007-05-05 10:26:37
Message-ID: 1178360797.289714.31233.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 661358 by cullmann:

remove the other new/delete pair, check the lineCount > line...

 M  +5 -3      katedocument.cpp  


--- trunk/KDE/kdelibs/kate/part/katedocument.cpp #661357:661358
@@ -1954,8 +1954,12 @@
     // multi-line regex search
     QString wholeDocument;
     const int lineCount = m_buffer->lines();
+    
+    // nothing to do...
+    if (line >= lineCount)
+      return KTextEditor::Range::invalid();
 
-    int * lineLens = new int[lineCount - line];
+    QVector<int> lineLens (lineCount - line);
 
     if (lineCount > line) // TODO
     {
@@ -1991,7 +1995,6 @@
     if (pos == -1)
     {
       // no match
-      delete [] lineLens;
       return KTextEditor::Range::invalid();
     }
     const int matchLen = regexp.matchedLength();
@@ -2070,7 +2073,6 @@
       }
     }
 
-    delete [] lineLens;
     return KTextEditor::Range(startLine, startCol, endLine, endCol);
   }
   else
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic