Plug a memory leak

Thanks to Pavel Roschin for spotting it.
Fix some module-specific globals not declared static

This prevents the symbol to be exported and possibly conflict with
another one.