Merge pull request #7345 from mhei/automake-update
[feed/packages.git] / libs / libssh / patches / 0012-pki_crypto-Avoid-potential-memory-leak.patch
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
6 Signed-off-by: Jakub Jelen <jjelen@redhat.com>
7 Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
8 ---
9 src/pki_crypto.c | 4 +++-
10 1 file changed, 3 insertions(+), 1 deletion(-)
11
12 diff --git a/src/pki_crypto.c b/src/pki_crypto.c
13 index 30f49a81..d9f7753a 100644
14 --- a/src/pki_crypto.c
15 +++ b/src/pki_crypto.c
16 @@ -453,7 +453,7 @@ int pki_key_generate_dss(ssh_key key, int parameter){
17 int rc;
18 #if OPENSSL_VERSION_NUMBER > 0x10100000L
19 key->dsa = DSA_new();
20 - if (!key->dsa) {
21 + if (key->dsa == NULL) {
22 return SSH_ERROR;
23 }
24 rc = DSA_generate_parameters_ex(key->dsa,
25 @@ -464,6 +464,8 @@ int pki_key_generate_dss(ssh_key key, int parameter){
26 NULL, /* h_ret */
27 NULL); /* cb */
28 if (rc != 1) {
29 + DSA_free(key->dsa);
30 + key->dsa = NULL;
31 return SSH_ERROR;
32 }
33 #else
34 --
35 2.19.1
36