Scan check complains of buildnameslist.c having memory leaks.

Reduced memory leak from 1.8M down to 0 by free()ing arrays and blocks.
Main() & dump() checks for errors.  Ensure files closed if dump() errors.
ReadNamesList() returns error instead of doing an abrupt exit(1). Turned
other void function into functions that return(1) so that dump() looks
more like main(); these other functions can check for errors in future.
Block free() done in head[], unnecessary double free() in final[].