diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-01 16:05:58 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-01 16:05:58 +0100 |
| commit | 4079491d5e003c424f1bfa2a3f682185cd0c54a7 (patch) | |
| tree | e3eb1222b7dbf20acee193ad959164be0a862eb9 /src | |
| parent | d7f8625e63fe098d2476a5a1406cf1897b075daf (diff) | |
| download | box64-4079491d5e003c424f1bfa2a3f682185cd0c54a7.tar.gz box64-4079491d5e003c424f1bfa2a3f682185cd0c54a7.zip | |
Main elf memory allocated
Diffstat (limited to 'src')
| -rwxr-xr-x | src/main.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index f5bbf9d6..c049a27d 100755 --- a/src/main.c +++ b/src/main.c @@ -732,5 +732,25 @@ int main(int argc, const char **argv, const char **env) { return execvp(argv[1], (char * const*)(argv+1)); } AddElfHeader(my_context, elf_header); + + if(CalcLoadAddr(elf_header)) { + printf_log(LOG_NONE, "Error: reading elf header of %s\n", my_context->argv[0]); + fclose(f); + free_contextargv(); + FreeBox64Context(&my_context); + FreeCollection(&ld_preload); + return -1; + } + // allocate memory + if(AllocElfMemory(my_context, elf_header, 1)) { + printf_log(LOG_NONE, "Error: allocating memory for elf %s\n", my_context->argv[0]); + fclose(f); + free_contextargv(); + FreeBox64Context(&my_context); + FreeCollection(&ld_preload); + return -1; + } + + return 0; } |