Improved leak and added a free for #8