MCPcopy Index your code
hub / github.com/RustPython/RustPython / cleanup_sni_ex_data

Function cleanup_sni_ex_data

crates/stdlib/src/openssl.rs:602–613  ·  view source on GitHub ↗

Clean up SNI callback data from SSL ex_data Called after handshake to free the data and release references

(ssl_ptr: *mut sys::SSL)

Source from the content-addressed store, hash-verified

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 {

Callers 1

do_handshakeMethod · 0.85

Calls 1

get_sni_ex_data_indexFunction · 0.85

Tested by

no test coverage detected