summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-18 14:13:07 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-18 14:13:07 +0000
commit45b085a0b221c89643f558118bb25204dd9bb7e3 (patch)
treedca20dc0bdc03484dbcd4b8db6368086b25bbf6f
parent3aae5bef4db3bd63a48b32bb21f472320795e7a0 (diff)
* win32/win32.c (open_ifs_socket): should not use plain malloc.
* win32/win32.c (rb_w32_opendir): should not use plain realloc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--win32/win32.c6
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index adb75e22c6..d6297cebe4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Jul 18 23:12:14 2006 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (open_ifs_socket): should not use plain malloc.
+
+ * win32/win32.c (rb_w32_opendir): should not use plain realloc.
+
Tue Jul 18 18:05:49 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* test/ruby/test_float.rb (TestFloat::test_strtod): update test to
diff --git a/win32/win32.c b/win32/win32.c
index 448a00bdca..d4ece006ae 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1462,7 +1462,7 @@ rb_w32_opendir(const char *filename)
// new name and it's null terminator
//
- #define Renew(x, y, z) (x = (z *)realloc(x, y))
+ #define Renew(x, y, z) (x = (z *)xrealloc(x, y))
Renew (p->start, idx+len+1, char);
if (p->start == NULL) {
@@ -2317,6 +2317,10 @@ open_ifs_socket(int af, int type, int protocol)
int protocols_available = 0;
proto_buffers = (WSAPROTOCOL_INFO *)malloc(proto_buffers_len);
+ if (!proto_buffers) {
+ WSASetLastError(WSA_NOT_ENOUGH_MEMORY);
+ return INVALID_SOCKET;
+ }
protocols_available =
WSAEnumProtocols(NULL, proto_buffers, &proto_buffers_len);