Merge "Solve three memory leaks related to PatchCache"