diff options
author | Jakub Jelen <jjelen@redhat.com> | 2019-12-16 16:42:50 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-12-23 14:31:32 +0100 |
commit | 059b6851dc0d42ab6bb9dbf7134ce4c30c52ce1f (patch) | |
tree | 47efe9a979fb6a1c9e338ac82820bd6b48588053 | |
parent | 71ba61cc5bda9661adf4ccee160480f26fbee678 (diff) | |
download | libssh-059b6851dc0d42ab6bb9dbf7134ce4c30c52ce1f.tar.gz libssh-059b6851dc0d42ab6bb9dbf7134ce4c30c52ce1f.tar.xz libssh-059b6851dc0d42ab6bb9dbf7134ce4c30c52ce1f.zip |
pki_mbedtls: Avoid potential memory leaks
reported by csbuild
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r-- | src/pki_mbedcrypto.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pki_mbedcrypto.c b/src/pki_mbedcrypto.c index ab09e2e9..b0fd82ef 100644 --- a/src/pki_mbedcrypto.c +++ b/src/pki_mbedcrypto.c @@ -113,7 +113,7 @@ ssh_key pki_private_key_from_base64(const char *b64_key, const char *passphrase, valid = auth_fn("Passphrase for private key:", (char *) tmp, MAX_PASSPHRASE_SIZE, 0, 0, auth_data); if (valid < 0) { - return NULL; + goto fail; } /* TODO fix signedness and strlen */ valid = mbedtls_pk_parse_key(rsa, @@ -155,7 +155,7 @@ ssh_key pki_private_key_from_base64(const char *b64_key, const char *passphrase, valid = auth_fn("Passphrase for private key:", (char *) tmp, MAX_PASSPHRASE_SIZE, 0, 0, auth_data); if (valid < 0) { - return NULL; + goto fail; } valid = mbedtls_pk_parse_key(ecdsa, (const unsigned char *) b64_key, |