Fix a memory leak in the binding