@@ -11,7 +11,8 @@ use nasl_c_lib::krb5::{
1111 OKrb5ErrorCode_O_KRB5_EXPECTED_NOT_NULL , OKrb5ErrorCode_O_KRB5_REALM_NOT_FOUND ,
1212 OKrb5ErrorCode_O_KRB5_SUCCESS , OKrb5GSSContext , OKrb5Slice , OKrb5Target , OKrb5User ,
1313 o_krb5_add_realm, o_krb5_find_kdc, o_krb5_gss_prepare_context, o_krb5_gss_session_key_context,
14- o_krb5_gss_update_context, okrb5_error_code_to_string, okrb5_gss_init_context,
14+ o_krb5_gss_update_context, okrb5_error_code_to_string, okrb5_gss_free_context,
15+ okrb5_gss_init_context,
1516} ;
1617use nasl_function_proc_macro:: nasl_function;
1718use std:: os;
@@ -190,20 +191,15 @@ impl Drop for Krb5 {
190191 }
191192 }
192193
193- // TODO: This block leads to munmap_chunk(): invalid pointer and Aborted (core dumped)
194- // let cached_gss_context = *self.cached_gss_context.lock().unwrap();
195- // if !cached_gss_context.is_null() {
196- // unsafe {
197- // okrb5_gss_free_context(cached_gss_context);
198- // }
199- // }
194+ let cached_gss_context = * self . cached_gss_context . lock ( ) . unwrap ( ) ;
195+ if !cached_gss_context. is_null ( ) {
196+ unsafe {
197+ okrb5_gss_free_context ( cached_gss_context) ;
198+ }
199+ }
200200 }
201201}
202202
203- // SAFETY: Krb5 can be safely sent between threads because:
204- // - The raw pointers are stored behind Arc<Mutex<...>> for synchronization
205- // - Access to the pointers is guarded by mutex locks
206- // - The outer Arc<Mutex<...>> provides the thread-safe coordination
207203unsafe impl Send for Krb5 { }
208204unsafe impl Sync for Krb5 { }
209205
0 commit comments