summaryrefslogtreecommitdiff
path: root/ext/socket/raddrinfo.c
diff options
context:
space:
mode:
authorJohn Hawthorn <[email protected]>2024-12-11 14:44:50 -0800
committerJohn Hawthorn <[email protected]>2024-12-11 15:37:32 -0800
commitd84859061a39b81b85bdbae8cfff5088a5c78a93 ()
treee80a4ac0dfe6da78c832f2df994264eebfd88ff8 /ext/socket/raddrinfo.c
parent9fe6fd86936ead769fe983feb5461ca4f192f16e (diff)
Use ruby_strdup/xfree in fast_fallback
Any memory allocated with xmalloc needs to be matched with xfree rather than plain free. Ruby unfortunately redefines strdup to be ruby_strdup, which uses xmalloc so needs to be xfreed. Previously these were mismatched. This commit changes the copy to be an explicit ruby_strdup (to avoid confusion) and the free to be xfree.
Notes: Merged: https://.com/ruby/ruby/pull/12311
-rw-r--r--ext/socket/raddrinfo.c4
1 files changed, 2 insertions, 2 deletions
@@ -3029,9 +3029,9 @@ rsock_io_socket_addrinfo(VALUE io, struct sockaddr *addr, socklen_t len)
void
free_fast_fallback_getaddrinfo_shared(struct fast_fallback_getaddrinfo_shared **shared)
{
- free((*shared)->node);
(*shared)->node = NULL;
- free((*shared)->service);
(*shared)->service = NULL;
rb_nativethread_lock_destroy(&(*shared)->lock);
free(*shared);