arch_library_init and arch_library_clone should be able to signal failure
- This then trickles to library_init, which needs to return int
- Callers of library_init were updated to unroll their transactions
upon failure
- PPC and ARM backends were updated to match the updated interface
diff --git a/ltrace-elf.c b/ltrace-elf.c
index 78b1245..19cae88 100644
--- a/ltrace-elf.c
+++ b/ltrace-elf.c
@@ -1007,9 +1007,10 @@
ltelf_read_main_binary(struct process *proc, const char *path)
{
struct library *lib = malloc(sizeof(*lib));
- if (lib == NULL)
+ if (lib == NULL || library_init(lib, LT_LIBTYPE_MAIN) < 0) {
+ free(lib);
return NULL;
- library_init(lib, LT_LIBTYPE_MAIN);
+ }
library_set_pathname(lib, path, 0);
/* There is a race between running the process and reading its