You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

  1. From c39f7578765859d7416e4140c92d034c8cae3341 Mon Sep 17 00:00:00 2001
  2. From: Jakub Jelen <jjelen@redhat.com>
  3. Date: Wed, 8 Nov 2017 15:35:08 +0100
  4. Subject: [PATCH] pki_crypto: Avoid potential memory leak
  5. Signed-off-by: Jakub Jelen <jjelen@redhat.com>
  6. Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
  7. ---
  8. src/pki_crypto.c | 4 +++-
  9. 1 file changed, 3 insertions(+), 1 deletion(-)
  10. diff --git a/src/pki_crypto.c b/src/pki_crypto.c
  11. index 30f49a81..d9f7753a 100644
  12. --- a/src/pki_crypto.c
  13. +++ b/src/pki_crypto.c
  14. @@ -453,7 +453,7 @@ int pki_key_generate_dss(ssh_key key, int parameter){
  15. int rc;
  16. #if OPENSSL_VERSION_NUMBER > 0x10100000L
  17. key->dsa = DSA_new();
  18. - if (!key->dsa) {
  19. + if (key->dsa == NULL) {
  20. return SSH_ERROR;
  21. }
  22. rc = DSA_generate_parameters_ex(key->dsa,
  23. @@ -464,6 +464,8 @@ int pki_key_generate_dss(ssh_key key, int parameter){
  24. NULL, /* h_ret */
  25. NULL); /* cb */
  26. if (rc != 1) {
  27. + DSA_free(key->dsa);
  28. + key->dsa = NULL;
  29. return SSH_ERROR;
  30. }
  31. #else
  32. --
  33. 2.19.1