summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-10 06:33:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-10 06:33:38 +0000
commitd63f9e933cf3ef44d7c6733bb6353ccde4324007 (patch)
treea049ef2eb132a4c7ba5083dd70249f035693fe89 /win32/win32.c
parent09b02349c212cac6395e9a634e3d4610e9bbc48c (diff)
win32.c: bail out if no memory
* win32/win32.c (rb_w32_write_console): bail out when buffer allocation failed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 7f5d736..85daa61 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -6534,6 +6534,7 @@ rb_w32_write_console(uintptr_t strarg, int fd)
/* assume UTF-8 */
case ENCINDEX_UTF_8:
ptr = wbuffer = mbstr_to_wstr(CP_UTF8, RSTRING_PTR(str), RSTRING_LEN(str), &len);
+ if (!ptr) return -1L;
break;
case ENCINDEX_UTF_16LE:
ptr = (const WCHAR *)RSTRING_PTR(str);