Fix a potential double free.