< Previous by Date | Date Index | Next by Date > |
< Previous in Thread | Thread Index | Next in Thread > |
Hi all, While executing some test using last revision we found a leak in SipMessage, in particular in copyOutboundDecoratorsToStackCancel() and copyOutboundDecoratorsToStackFailureAck()
methods. In fact, in those methods new operator is used to create a new auto_ptr that is next used by value as argument of
addOutboundDecorator() method, but pointer is never released. I think that also in that methods we should create auto_ptr for cloned decorator as is done, for example, in DialogUsageManager::send() method. See below the proposed change. Thank you and kind regards, Dario. void
SipMessage::copyOutboundDecoratorsToStackCancel(SipMessage& cancel) { std::vector<MessageDecorator*>::iterator i; for (i = mOutboundDecorators.begin(); i != mOutboundDecorators.end(); i++) { if((*i)->copyToStackCancels()) { --- cancel.addOutboundDecorator(*(new auto_ptr<MessageDecorator>((*i)->clone()))); +++ cancel.addOutboundDecorator(std::auto_ptr<MessageDecorator>((*i)->clone())); }
} } void
SipMessage::copyOutboundDecoratorsToStackFailureAck(SipMessage& ack) { std::vector<MessageDecorator*>::iterator i; for (i = mOutboundDecorators.begin(); i != mOutboundDecorators.end(); i++) { if((*i)->copyToStackFailureAcks()) { --- ack.addOutboundDecorator(*(new auto_ptr<MessageDecorator>((*i)->clone()))); +++ ack.addOutboundDecorator(std::auto_ptr<MessageDecorator>((*i)->clone())); }
} } From: resiprocate-devel [mailto:resiprocate-devel-bounces@xxxxxxxxxxxxxxx]
On Behalf Of Jan Granqvist Hi all, Method 'clear' executes // !bwc! The "invalid" 0 index. But when method 'init' continues executing // .bwc. Clear out the pesky invalid 0 index. the memory got lost. I assume the problem also will occur when calling the assignment operator. Thanks /Janne |