Skip to content

Task::postNotification possible leak #3240

@micheleselea

Description

@micheleselea

When we call this function
void postNotification(Notification* pNf)
if the _pOwner is null you will end up in a memory leak because you usually call the method like
postNotification(new Poco::TaskCustomNotification<some_class>(

and moreover if you try to do this

Poco::TaskCustomNotification<some_class>::Ptr cNF = new Poco::TaskCustomNotification<some_class>(this);
postNotification(cNF );

you will endup with a double delete, because the _pOwner->postNotification(pNf); inside take ownership regardless if you have the ::Ptr outside.
Probably the postNotification(Notification* pNf) should be changed in postNotification(Notification::Ptr pNf)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions