Menu ▾ ▴

#4 memory leak when using actions in a control point

open
nobody
None
5
2005-06-28
2005-06-28
tropics
No

i used this code fragment

if (action->postControlAction())
{
ArgumentList* outlist = action-
>getOutputArgumentList();
buffer = outlist->getArgument(item)->getValue();
}

repeatedly once a second in a program and noticed a
memory leak. in Action.cpp line 182 the ActionResponse
object is created, but it is deleted in ActionData.cpp line
47 while being assigned to a ControlResponse*. the
destructor therefore needs to be virtual.

i changed the base class HTTPPacket in HTTPPacket.h
line 54 to have a virtual destructor. that fixed the memory
leak. it might be sufficient though to make the
ControlResponse virtual, not sure about that.

Discussion