fix macro memory leak bug