Refactor: libcrmcommon: Improve scandir() error checking for schemas
And free namelist on error. The scandir(3) man page doesn't specify that
nothing is allocated on error... though I would hope that's the case.
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>