summaryrefslogtreecommitdiffstats
path: root/sys/kern/link_elf_obj.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/link_elf_obj.c')
-rw-r--r--sys/kern/link_elf_obj.c57
1 files changed, 19 insertions, 38 deletions
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c
index dc13283..0aa1326 100644
--- a/sys/kern/link_elf_obj.c
+++ b/sys/kern/link_elf_obj.c
@@ -896,8 +896,7 @@ out:
vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
if (error && lf)
linker_file_unload(lf, LINKER_UNLOAD_FORCE);
- if (hdr)
- free(hdr, M_LINKER);
+ free(hdr, M_LINKER);
return error;
}
@@ -928,18 +927,12 @@ link_elf_unload_file(linker_file_t file)
}
}
if (ef->preloaded) {
- if (ef->reltab)
- free(ef->reltab, M_LINKER);
- if (ef->relatab)
- free(ef->relatab, M_LINKER);
- if (ef->progtab)
- free(ef->progtab, M_LINKER);
- if (ef->ctftab)
- free(ef->ctftab, M_LINKER);
- if (ef->ctfoff)
- free(ef->ctfoff, M_LINKER);
- if (ef->typoff)
- free(ef->typoff, M_LINKER);
+ free(ef->reltab, M_LINKER);
+ free(ef->relatab, M_LINKER);
+ free(ef->progtab, M_LINKER);
+ free(ef->ctftab, M_LINKER);
+ free(ef->ctfoff, M_LINKER);
+ free(ef->typoff, M_LINKER);
if (file->filename != NULL)
preload_delete_name(file->filename);
/* XXX reclaim module memory? */
@@ -947,37 +940,25 @@ link_elf_unload_file(linker_file_t file)
}
for (i = 0; i < ef->nreltab; i++)
- if (ef->reltab[i].rel)
- free(ef->reltab[i].rel, M_LINKER);
+ free(ef->reltab[i].rel, M_LINKER);
for (i = 0; i < ef->nrelatab; i++)
- if (ef->relatab[i].rela)
- free(ef->relatab[i].rela, M_LINKER);
- if (ef->reltab)
- free(ef->reltab, M_LINKER);
- if (ef->relatab)
- free(ef->relatab, M_LINKER);
- if (ef->progtab)
- free(ef->progtab, M_LINKER);
+ free(ef->relatab[i].rela, M_LINKER);
+ free(ef->reltab, M_LINKER);
+ free(ef->relatab, M_LINKER);
+ free(ef->progtab, M_LINKER);
if (ef->object) {
vm_map_remove(kernel_map, (vm_offset_t) ef->address,
(vm_offset_t) ef->address +
(ef->object->size << PAGE_SHIFT));
}
- if (ef->e_shdr)
- free(ef->e_shdr, M_LINKER);
- if (ef->ddbsymtab)
- free(ef->ddbsymtab, M_LINKER);
- if (ef->ddbstrtab)
- free(ef->ddbstrtab, M_LINKER);
- if (ef->shstrtab)
- free(ef->shstrtab, M_LINKER);
- if (ef->ctftab)
- free(ef->ctftab, M_LINKER);
- if (ef->ctfoff)
- free(ef->ctfoff, M_LINKER);
- if (ef->typoff)
- free(ef->typoff, M_LINKER);
+ free(ef->e_shdr, M_LINKER);
+ free(ef->ddbsymtab, M_LINKER);
+ free(ef->ddbstrtab, M_LINKER);
+ free(ef->shstrtab, M_LINKER);
+ free(ef->ctftab, M_LINKER);
+ free(ef->ctfoff, M_LINKER);
+ free(ef->typoff, M_LINKER);
}
static const char *
OpenPOWER on IntegriCloud