memleak check code