Fix a memory leak in this module