Fix memory leak when pulishing notifications.