plug memleak (currently unused func); from Tiago Cunha