[Bug 592] New: Memory leak in RTT::ConnectionC class

For more infomation about this bug, visit
Summary: Memory leak in RTT::ConnectionC class
Product: RTT
Version: 1.4.2
Platform: All
OS/Version: All
Status: NEW
Severity: minor
Priority: P4
Component: Real-Time Toolkit (RTT)
AssignedTo: orocos-dev [..] ...
ReportedBy: manfredehrhart [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

Hi,
I notice that valgrind tool reports a leak at ConnectionC.hpp line 115. The
instantiated detail::CallbackWrapper is never deleted. The wrapper is assigned
to the ConnectionC::D::syn_ecb member, which is a simple raw pointer, and this
pointer is not deleted when the connection is destroyed.
I think it is the same for asynchronous callback.

Step to reproduce:
------------------
the problem typically arises when we create an event connection between 2 tasks

void MyClass::foo()
{
Handle h = a_task.events().setupConnction("an_event").callback(
this, &MyClass::handle_event).handle();

....
}
void MyClass::handle_event(...)
{
....
}

valgrind log
------------
==31071== at 0x4005B65: operator new(unsigned) (vg_replace_malloc.c:163)
==31071== by 0x8277F8E: RTT::ConnectionC&
RTT::ConnectionC::callback (krt::core::RT_task::*)(krt::core::watchdog_error)>(krt::core::RT_task*, void
(krt::core::RT_task::*)(krt::core::watchdog_error)) (ConnectionC.hpp:115)

Forum post at http://orocos.org/node/868

Manfred