From: Dr. Stephen Henson Date: Mon, 13 Apr 2009 11:31:22 +0000 (+0000) Subject: PR: 1785 X-Git-Tag: OpenSSL_1_0_0-beta2~21 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=55ed10db21d2bd5455946c8cd60926aa78ebdefb;p=oweals%2Fopenssl.git PR: 1785 Submitted by: Ger Hobbelt Approved by: steve@openssl.org Properly handle malloc failure. --- diff --git a/crypto/dsa/dsa_asn1.c b/crypto/dsa/dsa_asn1.c index 084bd451c6..8277a74be2 100644 --- a/crypto/dsa/dsa_asn1.c +++ b/crypto/dsa/dsa_asn1.c @@ -69,12 +69,15 @@ static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, if(operation == ASN1_OP_NEW_PRE) { DSA_SIG *sig; sig = OPENSSL_malloc(sizeof(DSA_SIG)); + if (!sig) + { + DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); + return 0; + } sig->r = NULL; sig->s = NULL; *pval = (ASN1_VALUE *)sig; - if(sig) return 2; - DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); - return 0; + return 2; } return 1; }