LearnBoost/node-canvas — pull request #318 by jasonrose (2013-08-15 23:58:30+00:00)
Title: Memory Leak Involving onload and onerror handlers in Image.cc

There appears to be a memory leak involving cleanup of the onload and onerror handlers in Image.cc.

From what my understanding of what the code does, is upon a successful load or error, the code invokes the applicable callback and deletes it. It currently, however, doesn't delete the allocated handler for the other code path. This leads to a propagation of orphaned onload/onerror c++ objects because they are not cleaned up in the destructor.

I'm not a very good c++ developer and could not get the deletes working in the Image destructor function, so I have inlined the deletes that prevent the memory leak from occurring.