about summary refs log tree commit diff stats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rwxr-xr-xsrc/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 90f513fd..4d5b7fe8 100755
--- a/src/main.c
+++ b/src/main.c
@@ -16,6 +16,7 @@
 #include "wine_tools.h"
 #include "elfloader.h"
 #include "custommem.h"
+#include "box64stack.h"
 
 box64context_t *my_context = NULL;
 int box64_log = LOG_NONE;
@@ -807,6 +808,14 @@ int main(int argc, const char **argv, const char **env) {
             printf_log(LOG_INFO, "BOX86: Using tcmalloc_minimal.so.4, and it's in the LD_PRELOAD command\n");
         }
     }
+    // get and alloc stack size and align
+    if(CalcStackSize(my_context)) {
+        printf_log(LOG_NONE, "Error: allocating stack\n");
+        free_contextargv();
+        FreeBox64Context(&my_context);
+        FreeCollection(&ld_preload);
+        return -1;
+    }
 
     return 0;
 }