LCS: Fix memory leak