Re: [CrystalSpace] #984: memory leak in occluvis.h (fix included)

"CrystalSpace" <[email protected]> Wed, 03 Jul 2013 07:46:57 -0000
Newsgroups gmane.comp.graphics.crystalspace.tracker
Message-ID <[email protected]>
#984: memory leak in occluvis.h (fix included)
---------------------------+------------------------------------------------
 Reporter:  ralphcampbell  |       Owner:  jorrit
     Type:  defect         |      Status:  new   
 Priority:  major          |   Milestone:        
Component:  renderer       |     Version:  V2.1  
 Keywords:                 |  
---------------------------+------------------------------------------------
Description changed by sunshine:

Old description:

> I was running valgrind with PlaneShift and found this.
> Other locations in occluvis.cpp are careful to delete the rmeshes array
> before reassigning the pointer but the destructor doesn't delete the
> array.
> This fixes the problem.
>
> {{{
> Index: include/csplugincommon/rendermanager/occluvis.h
> ===================================================================
> --- include/csplugincommon/rendermanager/occluvis.h     (revision 39444)
> +++ include/csplugincommon/rendermanager/occluvis.h     (working copy)
> @@ -193,6 +193,10 @@
>
>          ~NodeMeshList ()
>          {
> +          for (int m = 0; m < numMeshes; ++m)
> +          {
> +            delete[] meshList[m].rmeshes;
> +          }
>            delete[] meshList;
>          }
>
> }}}

New description:

 I was running valgrind with PlaneShift and found this.
 Other locations in `occluvis.cpp` are careful to delete the `rmeshes`
 array before reassigning the pointer but the destructor doesn't delete the
 array.
 This fixes the problem.

 {{{
 #!diff
 Index: include/csplugincommon/rendermanager/occluvis.h
 ===================================================================
 --- include/csplugincommon/rendermanager/occluvis.h     (revision 39444)
 +++ include/csplugincommon/rendermanager/occluvis.h     (working copy)
 @@ -193,6 +193,10 @@

          ~NodeMeshList ()
          {
 +          for (int m = 0; m < numMeshes; ++m)
 +          {
 +            delete[] meshList[m].rmeshes;
 +          }
            delete[] meshList;
          }

 }}}

--

-- 
Ticket URL: <http://www.crystalspace3d.org/trac/CS/ticket/984#comment:1>
CrystalSpace <http://www.crystalspace3d.org/>
Free open-source 3D SDK.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev