Buffer double-free with shared_ptr

Code reviewHard24 minBloomberg and Apple style

Your task

Review this C++ cleanup code mixing shared_ptr with manual delete.