File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2249,7 +2249,7 @@ static int action_luksAddKey(void)
22492249{
22502250 bool pin_provided = false;
22512251 int keyslot_old , keyslot_new , keysize = 0 , r = - EINVAL ;
2252- char * key = NULL , * password = NULL , * vk_description = NULL ;
2252+ char * key , * vk_description , * password = NULL ;
22532253 size_t password_size = 0 ;
22542254 struct crypt_device * cd = NULL ;
22552255 struct crypt_keyslot_context * p_kc_new = NULL , * kc = NULL , * kc_new = NULL ;
@@ -2325,8 +2325,10 @@ static int action_luksAddKey(void)
23252325 if (r == - EPERM )
23262326 log_err (_ ("Volume key does not match the volume." ));
23272327 check_signal (& r );
2328- if (r < 0 )
2328+ if (r < 0 ) {
2329+ crypt_safe_free (key );
23292330 goto out ;
2331+ }
23302332 r = crypt_keyslot_context_init_by_volume_key (cd , key , keysize , & kc );
23312333 crypt_safe_free (key );
23322334 } else if (ARG_SET (OPT_VOLUME_KEY_KEYRING_ID )) {
You can’t perform that action at this time.
0 commit comments