diff options
| author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-07-18 14:13:07 +0000 |
|---|---|---|
| committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-07-18 14:13:07 +0000 |
| commit | aef6cd7c5bba53bde166de5e971f85d5ed456a1e (patch) | |
| tree | dca20dc0bdc03484dbcd4b8db6368086b25bbf6f /win32 | |
| parent | 08a3897f32b2c742ea6a69a49ad1cc4175df0862 (diff) | |
| download | ruby-aef6cd7c5bba53bde166de5e971f85d5ed456a1e.tar.gz ruby-aef6cd7c5bba53bde166de5e971f85d5ed456a1e.tar.xz ruby-aef6cd7c5bba53bde166de5e971f85d5ed456a1e.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@10562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
| -rw-r--r-- | win32/win32.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c index 448a00bdc..d4ece006a 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); |
