Skip to content

Commit

Permalink
(xmlsec-gcrypt) Fix double free in xmlSecGCryptAsymKeyDataGenerate (l…
Browse files Browse the repository at this point in the history
  • Loading branch information
lsh123 committed May 17, 2024
1 parent c866f7f commit 243afff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/gcrypt/asymkeys.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ xmlSecGCryptAsymKeyDataAdoptKey(xmlSecKeyDataPtr data, gcry_sexp_t key_pair) {
pub_key = NULL; /* data owns it now */
priv_key = NULL; /* data owns it now */

/* Adopt functions assume ownership on success thus the caller would expect this to be released */
gcry_sexp_release(key_pair);

/* success */
res = 0;

Expand All @@ -194,9 +197,6 @@ xmlSecGCryptAsymKeyDataAdoptKey(xmlSecKeyDataPtr data, gcry_sexp_t key_pair) {
gcry_sexp_release(priv_key);
}

/* Adopt functions assume ownership thus the caller would expect this to be released */
gcry_sexp_release(key_pair);

/* done */
return(res);
}
Expand Down

0 comments on commit 243afff

Please sign in to comment.