Commit | Line | Data |
---|---|---|
1fac669c MB |
1 | diff --git a/ltrace-elf.c b/ltrace-elf.c |
2 | index f439cb0..60f1941 100644 | |
3 | --- a/ltrace-elf.c | |
4 | +++ b/ltrace-elf.c | |
5 | @@ -423,7 +423,9 @@ ltelf_destroy(struct ltelf *lte) | |
33b7171d MB |
6 | debug(DEBUG_FUNCTION, "close_elf()"); |
7 | elf_end(lte->elf); | |
8 | close(lte->fd); | |
9 | - VECT_DESTROY(<e->plt_relocs, GElf_Rela, NULL, NULL); | |
10 | + if (lte->plt_relocs.elt_size) { | |
11 | + VECT_DESTROY(<e->plt_relocs, GElf_Rela, NULL, NULL); | |
12 | + } | |
13 | } | |
14 | ||
15 | static void | |
1fac669c MB |
16 | @@ -1149,9 +1151,11 @@ read_module(struct library *lib, struct process *proc, |
17 | * determine whether ABI is supported. This is to get | |
18 | * reasonable error messages when trying to run 64-bit binary | |
19 | * with 32-bit ltrace. It is desirable to preserve this. */ | |
20 | - proc->e_machine = lte.ehdr.e_machine; | |
21 | - proc->e_class = lte.ehdr.e_ident[EI_CLASS]; | |
22 | - get_arch_dep(proc); | |
23 | + if (proc->e_machine == 0) { | |
24 | + proc->e_machine = lte.ehdr.e_machine; | |
25 | + proc->e_class = lte.ehdr.e_ident[EI_CLASS]; | |
26 | + get_arch_dep(proc); | |
27 | + } | |
28 | ||
29 | /* Find out the base address. For PIE main binaries we look | |
30 | * into auxv, otherwise we scan phdrs. */ |