Fix a memory leak reported in #36