summaryrefslogtreecommitdiffstats
path: root/crypto/pem
diff options
context:
space:
mode:
authorAlessandro Ghedini <alessandro@ghedini.me>2015-10-08 14:38:57 +0200
committerRichard Levitte <levitte@openssl.org>2015-10-23 19:58:54 +0200
commite90f1d9b74275c11e3492e521e46f4b1afa6f883 (patch)
tree2836966e5a5c05f9d2960ffd5efce899f50f5c58 /crypto/pem
parent5a1e6b1342f776f9304d9fa374149e317903b737 (diff)
Fix memory leaks and other mistakes on errors
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 3f6c7691870d1cd2ad0e0c83638cef3f35a0b548)
Diffstat (limited to 'crypto/pem')
-rw-r--r--crypto/pem/pvkfmt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c
index ee4b6a8241..54df0b44b1 100644
--- a/crypto/pem/pvkfmt.c
+++ b/crypto/pem/pvkfmt.c
@@ -692,23 +692,23 @@ static EVP_PKEY *do_PVK_body(const unsigned char **in,
inlen = PEM_def_callback(psbuf, PEM_BUFSIZE, 0, u);
if (inlen <= 0) {
PEMerr(PEM_F_DO_PVK_BODY, PEM_R_BAD_PASSWORD_READ);
- return NULL;
+ goto err;
}
enctmp = OPENSSL_malloc(keylen + 8);
if (!enctmp) {
PEMerr(PEM_F_DO_PVK_BODY, ERR_R_MALLOC_FAILURE);
- return NULL;
+ goto err;
}
if (!derive_pvk_key(keybuf, p, saltlen,
(unsigned char *)psbuf, inlen))
- return NULL;
+ goto err;
p += saltlen;
/* Copy BLOBHEADER across, decrypt rest */
memcpy(enctmp, p, 8);
p += 8;
if (keylen < 8) {
PEMerr(PEM_F_DO_PVK_BODY, PEM_R_PVK_TOO_SHORT);
- return NULL;
+ goto err;
}
inlen = keylen - 8;
q = enctmp + 8;