Fix memory leak (pattern).