shared_ptr free; dynamic cast free