Mem leak fix: Replace alloc_namelist() calls with
local mallocs since each name gets allocated after