Clean up SNI callback data from SSL ex_data Called after handshake to free the data and release references
(ssl_ptr: *mut sys::SSL)
| 600 | // Clean up SNI callback data from SSL ex_data |
| 601 | // Called after handshake to free the data and release references |
| 602 | unsafe fn cleanup_sni_ex_data(ssl_ptr: *mut sys::SSL) { |
| 603 | unsafe { |
| 604 | let idx = get_sni_ex_data_index(); |
| 605 | let data_ptr = sys::SSL_get_ex_data(ssl_ptr, idx); |
| 606 | if !data_ptr.is_null() { |
| 607 | // Free the Box<SniCallbackData> - this releases references to context and socket |
| 608 | let _ = Box::from_raw(data_ptr as *mut SniCallbackData); |
| 609 | // Clear the ex_data to prevent double-free |
| 610 | sys::SSL_set_ex_data(ssl_ptr, idx, std::ptr::null_mut()); |
| 611 | } |
| 612 | } |
| 613 | } |
| 614 | |
| 615 | // Get or create an ex_data index for msg_callback data |
| 616 | fn get_msg_callback_ex_data_index() -> libc::c_int { |
no test coverage detected