diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-26 05:48:12 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-26 05:48:12 +0000 |
commit | ea9ff28f80165ec054106702ee38f5995bc4a491 (patch) | |
tree | d3559a1a191a898f816ac5adf56f1310a920142d /win32/file.c | |
parent | aac77886b318d2272d0bce29cede4566332ea205 (diff) |
win32: realloc failures
* win32/file.c (code_page_i): handle realloc failure.
reported by Denis Denisov <denji0k AT gmail.com>.
* win32/stub.c (stub_sysinit): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/file.c')
-rw-r--r-- | win32/file.c | 7 |
1 files changed, 5 insertions, 2 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; |