diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-20 02:06:42 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-20 02:06:42 +0000 |
commit | f76652b60e66c171bf1c3d70cb5469245d2bc2bf (patch) | |
tree | 7cc376d79d80b16b340be2219a6f80e69826a303 /ext/socket | |
parent | 936aa524ae8085b7140b6753f0178f123cd381e8 (diff) | |
download | ruby-f76652b60e66c171bf1c3d70cb5469245d2bc2bf.tar.gz ruby-f76652b60e66c171bf1c3d70cb5469245d2bc2bf.tar.xz ruby-f76652b60e66c171bf1c3d70cb5469245d2bc2bf.zip |
* gc.c (gc_sweep): loosen page free condition to avoid add_heap()
race condition. [ruby-dev:21633]
* gc.c (gc_sweep): do not update malloc_limit when malloc_increase
is smaller than malloc_limit.
* ext/socket/socket.c (make_hostent): h_aliases may be NULL.
(ruby-bugs PR#1195)
* ext/socket/socket.c (sock_s_gethostbyaddr): ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r-- | ext/socket/socket.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 95ec45bfe..aa568cf6b 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -1046,8 +1046,10 @@ make_hostent(addr, ipaddr) #else h = gethostbyname(addr->ai_canonname); #endif - for (pch = h->h_aliases; *pch; pch++) { - rb_ary_push(names, rb_str_new2(*pch)); + if (h->h_aliases != NULL) { + for (pch = h->h_aliases; *pch; pch++) { + rb_ary_push(names, rb_str_new2(*pch)); + } } #if defined(HAVE_GETIPNODEBYNAME) freehostent(h); @@ -2022,8 +2024,10 @@ sock_s_gethostbyaddr(argc, argv) rb_ary_push(ary, rb_str_new2(h->h_name)); names = rb_ary_new(); rb_ary_push(ary, names); - for (pch = h->h_aliases; *pch; pch++) { - rb_ary_push(names, rb_str_new2(*pch)); + if (h->h_aliases != NULL) { + for (pch = h->h_aliases; *pch; pch++) { + rb_ary_push(names, rb_str_new2(*pch)); + } } rb_ary_push(ary, INT2NUM(h->h_addrtype)); #ifdef h_addr |