Fix memory leak

Introduced in commit dc7a1fcace85eca1c877dce575d320e975806d7d