cocaine/cocaine-plugins — pull request #2 by bogdad (2012-07-06 15:13:44+00:00)
Title: memory leak in python/io.cpp

Hi again,

There is a memory leak in plugins/python/io.cpp

Since python_io_t implicit cpp destructor is not called when
invoking python_io_t::destructor

the blob_t python_io_t::request destructor is not called either.
blob_t contains a shared_ptr m_ref_counter,
and so its destructor is not called also.

which results in hanging reference_counter instance (memory leak)

The proposed solution:
in python_io_t::destructor
assign self->request to some dummy static non empy blob_t to cause m_ref_counter.reset() which would destroy the hanging reference_counter.

Another solution could be modifying blob_t::clear() method to reset m_ref_counter, but it seems unnatural
to change blob_t because of python issues.

Thanks,
Vladimir Shakhov (bogdad@gmail.com)