bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ cplusplus-bug 580197 ] misc.h: ~iterator() delete token


From: David Sugar
Subject: Re: [ cplusplus-bug 580197 ] misc.h: ~iterator() delete token
Date: Wed, 14 Aug 2002 06:27:01 -0400
User-agent: KMail/1.4.1

Yes, we should always use a matching delete[] if originally new xxx[] was 
used, even for base types like char arrays.  On some c++ compilers, []'s have 
extra block information, and so using a simple delete will cause a memory 
leak.

On Tuesday 13 August 2002 16:20, Federico Montesino Pouzols wrote:
>   Hi, this is now fixed in the cvs hosted at savannah.
>
>
> ------------------------------------------------------
>  virtual ~iterator() { if (token) *token='\0'; delete
> token; }
>
> should be delete [] token because token is allocated as
> an array in keydata.cpp. A check of keydata.cpp will
> show a correct call to delete[] token in operator++.
>
> Probably won't cause a problem because elements of
> array are primitive type "char", but a check of the ARM
> says behavior is implementation dependent.
>
> Bug is in 1.9.7 and 2.0.99
>
>
>
>
> _______________________________________________
> Bug-commoncpp mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp





reply via email to

[Prev in Thread] Current Thread [Next in Thread]