summaryrefslogtreecommitdiff
path: root/elfcopy/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'elfcopy/main.c')
-rw-r--r--elfcopy/main.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/elfcopy/main.c b/elfcopy/main.c
index b58c01ac7bbd..42430ccea0a9 100644
--- a/elfcopy/main.c
+++ b/elfcopy/main.c
@@ -39,7 +39,7 @@
#include "elfcopy.h"
-ELFTC_VCSID("$Id: main.c 3577 2017-09-14 02:19:42Z emaste $");
+ELFTC_VCSID("$Id: main.c 3757 2019-06-28 01:15:28Z emaste $");
enum options
{
@@ -388,9 +388,6 @@ create_elf(struct elfcopy *ecp)
errx(EXIT_FAILURE, "gelf_update_ehdr() failed: %s",
elf_errmsg(-1));
- /* Generate section name string table (.shstrtab). */
- set_shstrtab(ecp);
-
/*
* Second processing of output sections: Update section headers.
* At this stage we set name string index, update st_link and st_info
@@ -486,6 +483,9 @@ free_elf(struct elfcopy *ecp)
/* Free symbol table buffers. */
free_symtab(ecp);
+ /* Free section name string table. */
+ elftc_string_table_destroy(ecp->shstrtab->strtab);
+
/* Free internal section list. */
if (!TAILQ_EMPTY(&ecp->v_sec)) {
TAILQ_FOREACH_SAFE(sec, &ecp->v_sec, sec_list, sec_temp) {
@@ -1565,7 +1565,6 @@ main(int argc, char **argv)
ecp = calloc(1, sizeof(*ecp));
if (ecp == NULL)
err(EXIT_FAILURE, "calloc failed");
- memset(ecp, 0, sizeof(*ecp));
ecp->itf = ecp->otf = ETF_ELF;
ecp->iec = ecp->oec = ELFCLASSNONE;