Ensure that memory is not freed before calling free_fast_fallback_getaddrinfo_*
(#12661)
Ensure that `getaddrinfo_entry` and `getaddrinfo_shared` exist before free them in the main thread.
This commit is contained in:
parent
2d3d7a74e9
commit
63b6323e04
Notes:
git
2025-01-29 13:19:21 +00:00
Merged-By: shioimm <shioi.mm@gmail.com>
@ -1168,9 +1168,13 @@ fast_fallback_inetsock_cleanup(VALUE v)
|
|||||||
rb_nativethread_lock_unlock(&getaddrinfo_shared->lock);
|
rb_nativethread_lock_unlock(&getaddrinfo_shared->lock);
|
||||||
|
|
||||||
for (int i = 0; i < arg->family_size; i++) {
|
for (int i = 0; i < arg->family_size; i++) {
|
||||||
if (need_free[i]) free_fast_fallback_getaddrinfo_entry(&arg->getaddrinfo_entries[i]);
|
if (arg->getaddrinfo_entries[i] && need_free[i]) {
|
||||||
|
free_fast_fallback_getaddrinfo_entry(&arg->getaddrinfo_entries[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (getaddrinfo_shared && shared_need_free) {
|
||||||
|
free_fast_fallback_getaddrinfo_shared(&getaddrinfo_shared);
|
||||||
}
|
}
|
||||||
if (shared_need_free) free_fast_fallback_getaddrinfo_shared(&getaddrinfo_shared);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int connection_attempt_fd;
|
int connection_attempt_fd;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user