summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/file.c7
-rw-r--r--win32/stub.c7
2 files changed, 11 insertions, 3 deletions
diff --git a/win32/file.c b/win32/file.c
index a50d6d8638..e2b7f93aa4 100644
--- a/win32/file.c
+++ b/win32/file.c
@@ -160,8 +160,11 @@ code_page_i(st_data_t name, st_data_t idx, st_data_t arg)
USHORT *table = cp->table;
if (count <= idx) {
unsigned int i = count;
- cp->count = count = (((idx + 4) & ~31) | 28);
- cp->table = table = realloc(table, count * sizeof(*table));
+ count = (((idx + 4) & ~31) | 28);
+ table = realloc(table, count * sizeof(*table));
+ if (!table) return ST_CONTINUE;
+ cp->count = count;
+ cp->table = table;
while (i < count) table[i++] = INVALID_CODE_PAGE;
}
table[idx] = (USHORT)code_page;
diff --git a/win32/stub.c b/win32/stub.c
index fc82d73e2c..3960024fc2 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);