File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
components/support/rc_crypto/nss/src/pk11 Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,14 @@ fn get_aes256_key(name: &str) -> Result<SymKey> {
217217 }
218218 . map_err ( |_| get_last_error ( ) ) ?;
219219
220+ // This cleanup will not run if a previous operation fails and causes an early return.
221+ // Using an RAII-style wrapper would be preferable to ensure the item is always freed,
222+ // but given that an earlier failure likely prevents startup, it is acceptable.
223+ //
224+ // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1992756 for a follow-up
225+ // improvement.
226+ unsafe { nss_sys:: SECITEM_FreeItem ( wrapped_key, nss_sys:: PR_TRUE ) }
227+
220228 map_nss_secstatus ( || unsafe { nss_sys:: PK11_ExtractKeyValue ( sym_key. as_mut_ptr ( ) ) } ) ?;
221229 Ok ( sym_key)
222230 }
You can’t perform that action at this time.
0 commit comments