pki_gcrypt: Fix memory leak

* src/pki_gcrypt.c (b64decode_rsa_privatekey): Free 'v' on version
mismatch.
(b64decode_dsa_privatekey): Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Justus Winter
2016-03-14 16:31:58 +01:00
committed by Andreas Schneider
parent 9a54f91bb7
commit e1d36314a2

View File

@@ -471,6 +471,7 @@ static int b64decode_rsa_privatekey(const char *pkey, gcry_sexp_t *r,
data = ssh_string_data(v);
if (ssh_string_len(v) != 1 || data[0] != 0) {
ssh_string_free(v);
ssh_buffer_free(buffer);
return 0;
}
@@ -547,6 +548,7 @@ static int b64decode_dsa_privatekey(const char *pkey, gcry_sexp_t *r, ssh_auth_c
data = ssh_string_data(v);
if (ssh_string_len(v) != 1 || data[0] != 0) {
ssh_string_free(v);
ssh_buffer_free(buffer);
return 0;
}