stage patch - pair delete[] with new[] in fasr.cc

View: New views
2 Messages — Rating Filter:   Alert me  

stage patch - pair delete[] with new[] in fasr.cc

by Jeff Donner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Fixes mismatch of new[] with delete - wants to be delete[].

valgrind:

==10087== Mismatched free() / delete / delete []
==10087==    at 0x4C24A7A: operator delete(void*) (vg_replace_malloc.c:346)
==10087==    by 0xE2707F1: Init (fasr.cc:516)
==10087==    by 0x4EBCB5D: Stg::Model::CallCallbacks(void*)
(model_callbacks.cc:57)
==10087==    by 0x4EAD48F: Stg::Model::InitControllers() (model.cc:359)
==10087==    by 0x4EE4A19: Stg::World::Load(char const*) (world.cc:394)
==10087==    by 0x4F0DFC7: Stg::WorldGui::Load(char const*) (worldgui.cc:268)
==10087==    by 0x40151B: main (main.cc:90)
==10087==  Address 0xdee1850 is 0 bytes inside a block of size 4,096 alloc'd
==10087==    at 0x4C255E4: operator new[](unsigned long)
(vg_replace_malloc.c:264)
==10087==    by 0xE2706A0: Init (fasr.cc:504)
==10087==    by 0x4EBCB5D: Stg::Model::CallCallbacks(void*)
(model_callbacks.cc:57)
==10087==    by 0x4EAD48F: Stg::Model::InitControllers() (model.cc:359)
==10087==    by 0x4EE4A19: Stg::World::Load(char const*) (world.cc:394)
==10087==    by 0x4F0DFC7: Stg::WorldGui::Load(char const*) (worldgui.cc:268)
==10087==    by 0x40151B: main (main.cc:90)
==10087==

Against stage 8330

Index: examples/ctrl/fasr.cc
===================================================================
--- examples/ctrl/fasr.cc (revision 8330)
+++ examples/ctrl/fasr.cc (working copy)
@@ -513,7 +513,7 @@
  putchar( data[x + ((dh-y-1)*dw)] ? 'O' : '.' );
  putchar( '\n' );
   }
- delete data;
+ delete[] data;
  }
 #endif
   

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Playerstage-developers mailing list
Playerstage-developers@...
https://lists.sourceforge.net/lists/listinfo/playerstage-developers

Re: stage patch - pair delete[] with new[] in fasr.cc

by Richard Vaughan-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

fixed, thanks.

-rtv

On Tue, Oct 27, 2009 at 6:37 PM, Jeff Donner <jeffrey.donner@...> wrote:

> Fixes mismatch of new[] with delete - wants to be delete[].
>
> valgrind:
>
> ==10087== Mismatched free() / delete / delete []
> ==10087==    at 0x4C24A7A: operator delete(void*) (vg_replace_malloc.c:346)
> ==10087==    by 0xE2707F1: Init (fasr.cc:516)
> ==10087==    by 0x4EBCB5D: Stg::Model::CallCallbacks(void*)
> (model_callbacks.cc:57)
> ==10087==    by 0x4EAD48F: Stg::Model::InitControllers() (model.cc:359)
> ==10087==    by 0x4EE4A19: Stg::World::Load(char const*) (world.cc:394)
> ==10087==    by 0x4F0DFC7: Stg::WorldGui::Load(char const*) (worldgui.cc:268)
> ==10087==    by 0x40151B: main (main.cc:90)
> ==10087==  Address 0xdee1850 is 0 bytes inside a block of size 4,096 alloc'd
> ==10087==    at 0x4C255E4: operator new[](unsigned long)
> (vg_replace_malloc.c:264)
> ==10087==    by 0xE2706A0: Init (fasr.cc:504)
> ==10087==    by 0x4EBCB5D: Stg::Model::CallCallbacks(void*)
> (model_callbacks.cc:57)
> ==10087==    by 0x4EAD48F: Stg::Model::InitControllers() (model.cc:359)
> ==10087==    by 0x4EE4A19: Stg::World::Load(char const*) (world.cc:394)
> ==10087==    by 0x4F0DFC7: Stg::WorldGui::Load(char const*) (worldgui.cc:268)
> ==10087==    by 0x40151B: main (main.cc:90)
> ==10087==
>
> Against stage 8330
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Playerstage-developers mailing list
> Playerstage-developers@...
> https://lists.sourceforge.net/lists/listinfo/playerstage-developers
>
>



--
Richard Vaughan
Autonomy Lab / Computing Science / Simon Fraser University

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Playerstage-developers mailing list
Playerstage-developers@...
https://lists.sourceforge.net/lists/listinfo/playerstage-developers