fix memory leak of invokestatic function.