Cherry-pick from 1.9-maint: Fix memory leak in XaResourceManager.