gl: add @ryg's leak checking

Very nifty! It works too.