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

List:       kde-commits
Subject:    Re: extragear/network/ktorrent
From:       "Joris Guisson" <joris.guisson () gmail ! com>
Date:       2009-01-13 17:34:08
Message-ID: 6bc528f40901130934n1ade9a3ds7b66905aa5f507d6 () mail ! gmail ! com
[Download RAW message or body]

If a BitSet is used in that manner it is a bug, so having it crash is
actually a good thing.

Joris,

On Tue, Jan 13, 2009 at 5:41 PM, Dominik Haumann <dhdev@gmx.de> wrote:
> On Tuesday 06 January 2009, Andreas Hartmetz wrote:
>> --- trunk/extragear/network/ktorrent/libbtcore/util/bitset.cpp
>> #906635:906636 @@ -94,8 +94,7 @@
>>
>>         BitSet & BitSet::operator = (const BitSet & bs)
>>         {
>> -               if (data)
>> -                       delete [] data;
>> +               delete [] data;
>>                 num_bytes = bs.num_bytes;
>>                 num_bits = bs.num_bits;
>>                 data = new Uint8[num_bytes];
>
> ...and while we are at it: operator= should check whether &bs == this.
> Otherwise you delete data and then access invalid memory. ;)
>
> Dominik
>
[prev in list] [next in list] [prev in thread] [next in thread] 

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