Fix a double free error