Sanitise DLL names in import table and fix memory leak