summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2015-02-14 15:11:23 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2015-02-14 15:11:23 +0000
commit8ee4752a31924309025570714140cfc4cc18aff1 (patch)
tree66bdfd01ef7af545666fd2296928d30376822cdc /lib
parent1744238599e41009da007cce7ee10086870fd8fc (diff)
Coverity CID 21733 (unchecked allocation), 78823 (leak on error).
ok doug@ jsing@
Diffstat (limited to 'lib')
-rw-r--r--lib/libssl/src/crypto/dsa/dsa_ameth.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libssl/src/crypto/dsa/dsa_ameth.c b/lib/libssl/src/crypto/dsa/dsa_ameth.c
index d4c8b111a88..b9ee49f0559 100644
--- a/lib/libssl/src/crypto/dsa/dsa_ameth.c
+++ b/lib/libssl/src/crypto/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;