Use CFFI's string free function and unwind-protect.