Coverity issues in test_glob()

Coverity Scan has reported some issues in test_glob(). These are test-only, so they don't reflect a security vulnerability, but we should fix them soon to keep our coverity backlog small.