MFC r345998-r346002, r346007-r346008: various loader improvements
r345998:
loader: malloc+bzero is calloc
Replace malloc+bzero in module.c with calloc.
r345999:
loader: file_addmodule should check for memory allocation
strdup() can return NULL.
r346000:
loader: remove pointer checks before free() in module.c
free() does check for NULL argument, remove duplicate checks.
r346001:
loader: file_addmetadata() should check for memory allocation
malloc() can return NULL.
r346002:
loader: mod_loadkld() error: we previously assumed 'last_file' could be null
The last_file variable is used to reset the loadaddr variable back to
original
value; however, it is possible the last_file is NULL, so we can not blindly
trust it. But then again, we can just save the original loadaddr and use
the saved value for recovery.
r346007:
loader: add file_remove() function to undo file_insert_tail().
346002 did miss the fact that we do not only undo the loadaddr, but also
we need to remove the inserted module. Implement file_remove() to do the
job.
r346008:
loader: command_lsefi: ret can be used uninitialized
UnifiedSplitRaw