From 8ee4752a31924309025570714140cfc4cc18aff1 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sat, 14 Feb 2015 15:11:23 +0000 Subject: Coverity CID 21733 (unchecked allocation), 78823 (leak on error). ok doug@ jsing@ --- lib/libssl/src/crypto/dsa/dsa_ameth.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/libssl') 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; -- cgit v1.2.3