fix mem leak of OS EventCallback function