diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-02-14 15:11:23 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-02-14 15:11:23 +0000 |
commit | db1ad8366b21177d579dc98e28a063bbdf6b60b6 (patch) | |
tree | 724d837ccfdfdf07e7ec16d495de32f5b75df0c8 /lib/libcrypto | |
parent | 8437d0dea4bc2ec6a07d6f73bf851a60ea2fa24f (diff) |
Coverity CID 21733 (unchecked allocation), 78823 (leak on error).
ok doug@ jsing@
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/dsa/dsa_ameth.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libcrypto/dsa/dsa_ameth.c b/lib/libcrypto/dsa/dsa_ameth.c index d4c8b111a88..b9ee49f0559 100644 --- a/lib/libcrypto/dsa/dsa_ameth.c +++ b/lib/libcrypto/dsa/dsa_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_ameth.c,v 1.16 2015/02/11 04:05:14 beck Exp $ */ +/* $OpenBSD: dsa_ameth.c,v 1.17 2015/02/14 15:11:22 miod Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -143,9 +143,14 @@ dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) ASN1_STRING *str; str = ASN1_STRING_new(); + if (str == NULL) { + DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE); + goto err; + } str->length = i2d_DSAparams(dsa, &str->data); if (str->length <= 0) { DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE); + ASN1_STRING_free(str); goto err; } pval = str; |