git-config: fix regexp memory leaks on error conditions