Fixed possible memory leak on lambda capture by value.