stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anton Pevtsov <ant...@moscow.vdiweb.com>
Subject Re: test for lib.alg.find.end
Date Mon, 05 Dec 2005 16:19:05 GMT
There is a memory leak in this test - I forgot to delete temporary
arrays.
Here is the patch which fixes the problem (the attached file contains
the same patch):

Index: 25.find.end.cpp
===================================================================
--- 25.find.end.cpp	(revision 354007)
+++ 25.find.end.cpp	(working copy)
@@ -129,7 +129,11 @@
                resoff, res.cur_ - first1.cur_);
 
     if (!success)
+    {
+        delete[] tsrc;
+        delete[] tfseq;
         return;
+    }
 
     if (res.cur_ != last1.cur_) {
         std::size_t j = 0;
@@ -146,7 +150,11 @@
                    fseq[j], (res.cur_ + j)->val_, j);
 
         if (!success)
+        {
+            delete[] tsrc;
+            delete[] tfseq;
             return;
+        }
     }
 
     success =
@@ -157,6 +165,9 @@
                __LINE__, it1name, it2name, src, fseq,
                predicate ? predicate : "comparison operator", 
                T::n_total_op_eq_, nfseq * (nsrc - nfseq + 1));
+
+    delete[] tsrc;
+    delete[] tfseq;
 }
 
 
/***********************************************************************
***/


With best wishes,
Anton Pevtsov

-----Original Message-----
From: Martin Sebor [mailto:sebor@roguewave.com] 
Sent: Sunday, December 04, 2005 00:38
To: stdcxx-dev@incubator.apache.org
Subject: Re: test for lib.alg.find.end


Anton Pevtsov wrote:

>> I have not found any test for the find_end algorithm. It is declared 
>> in 25.find.cpp but there is no exercise for it anywhere. So I 
>> implemented this test. It is in the attached file.
>  
>

Excellent! It lookgs good. I committed it with the change below:
http://svn.apache.org/viewcvs.cgi?rev=352022&view=rev

Thanks!
Martin



Mime
View raw message