I found a memory leak in array.cpp and need some help fixing it.

At line 889 there is function attachArrayProperties():


static void
attachArrayProperties(as_object& proto)
{
        boost::intrusive_ptr<builtin_function> gettersetter;

        gettersetter = new builtin_function(&array_length, NULL);
        proto.init_property("length", *gettersetter, *gettersetter);
}


Valgrind reports that "gettersetter" is "defenitely lost" (never
freed). I confirmed this by uncommenting the function's code, which
"fixes" the memory leak.

Unfortunately I don't know much about intrusive_ptr but does
"*gettersetter" not just return the pointer itself without changing
it's reference count? At the other hand I don't understand why
"gettersetter" is freed immediately when the function returns..


Can somebody help me out here? This should fix memory leaks for
each(!) function call.


Testcase:

Simplistic movie (attached) with just this code:

  this.onEnterFrame = function() {};


Udo

Attachment: memleak-test2.swf
Description: application/shockwave-flash

_______________________________________________
Gnash-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-dev

Reply via email to