Subject: Re: Commit: Re: patch: one-liner for 1134
From: Joaquin Cuenca Abela (cuenca@celium.net)
Date: Fri Mar 30 2001 - 02:32:59 CST
On 30 Mar 2001 15:53:33 +1000, Martin Sevior wrote:
> 
> 
> On Fri, 30 Mar 2001, Patrick Lam wrote:
> 
> > This fixes a crasher which occurs when clearing tab stops.
> > 
> > pat
> > 
> 
> Hi Pat,
>       Thanks for this. I just made the change of adding a
> 
> delete m_pszTabStops;
> 
> Just before we leave the method to not leak the 2 bytes of memory :-)
From the patch that I'm seeing, and if m_pszTabStops is allocated as
m_pszTabStops = new char[1];
then you can only leak 1 byte of memory.  And to prevent the leaking you
should do:
delete[] m_pszTabStops;
and not:
delete m_pszTabStops;
remember, when you allocate using new stuff[number]; you should
deallocate using delete[] stuff.  Or even better (for those that thinks
that the macros actually make a difference) use DELETEPV(stuff);
Cheers,
PS: btw, if m_pszTabStops is not a null terminated string (I don't see
how it can be a null terminated string if it only has a byte), it should
not use the prefix sz.
-- Joaquín Cuenca Abela cuenca@celium.net
This archive was generated by hypermail 2b25 : Fri Mar 30 2001 - 02:35:02 CST