Fix a potential memory leak

Actually, it was in the original patch (fd8dd36f626ee59ee4f205cb106bf6686ea8b6eb)
but somehow missed in the actual merge (7db6eef89bfdb1a4d8e0c2299b212004bf7cbc9f).