File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -809,13 +809,15 @@ mod tests {
809809
810810 #[ test]
811811 fn test_raw_ctx ( ) {
812+ use std:: mem:: ManuallyDrop ;
813+
812814 let ctx_full = Secp256k1 :: new ( ) ;
813815 let ctx_sign = Secp256k1 :: signing_only ( ) ;
814816 let ctx_vrfy = Secp256k1 :: verification_only ( ) ;
815817
816- let full = unsafe { Secp256k1 :: from_raw_all ( ctx_full. ctx ) } ;
817- let sign = unsafe { Secp256k1 :: from_raw_signining_only ( ctx_sign. ctx ) } ;
818- let vrfy = unsafe { Secp256k1 :: from_raw_verification_only ( ctx_vrfy. ctx ) } ;
818+ let mut full = unsafe { Secp256k1 :: from_raw_all ( ctx_full. ctx ) } ;
819+ let mut sign = unsafe { Secp256k1 :: from_raw_signining_only ( ctx_sign. ctx ) } ;
820+ let mut vrfy = unsafe { Secp256k1 :: from_raw_verification_only ( ctx_vrfy. ctx ) } ;
819821
820822 let ( sk, pk) = full. generate_keypair ( & mut thread_rng ( ) ) ;
821823 let msg = Message :: from_slice ( & [ 2u8 ; 32 ] ) . unwrap ( ) ;
@@ -827,8 +829,15 @@ mod tests {
827829 assert ! ( vrfy. verify( & msg, & sig, & pk) . is_ok( ) ) ;
828830 assert ! ( full. verify( & msg, & sig, & pk) . is_ok( ) ) ;
829831
830- drop ( full) ; drop ( sign) ; drop ( vrfy) ;
831- drop ( ctx_full) ; drop ( ctx_sign) ; drop ( ctx_vrfy) ;
832+ unsafe {
833+ ManuallyDrop :: drop ( & mut full) ;
834+ ManuallyDrop :: drop ( & mut sign) ;
835+ ManuallyDrop :: drop ( & mut vrfy) ;
836+
837+ }
838+ drop ( ctx_full) ;
839+ drop ( ctx_sign) ;
840+ drop ( ctx_vrfy) ;
832841 }
833842
834843 #[ test]
You can’t perform that action at this time.
0 commit comments