removed memory leaks in example (used boost:shared_ptr)