summaryrefslogtreecommitdiff
path: root/win32/stub.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/stub.c')
-rw-r--r--win32/stub.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/win32/stub.c b/win32/stub.c
index fc82d73..3960024 100644
--- a/win32/stub.c
+++ b/win32/stub.c
@@ -21,7 +21,12 @@ stub_sysinit(int *argc, char ***argv)
for (i = 1; i < ac; ++i) {
lenall += strlen(av[i]) + 1;
}
- *argv = av = realloc(av, lenall + (lenexe + 1) * 2 + sizeof(char *) * (i + 2));
+ av = realloc(av, lenall + (lenexe + 1) * 2 + sizeof(char *) * (i + 2));
+ if (!av) {
+ perror("realloc command line");
+ exit(-1);
+ }
+ *argv = av;
*argc = ++ac;
p = (char *)(av + i + 2);
memmove(p + (lenexe + 1) * 2, (char *)(av + ac) + len0, lenall);