aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1/a_digest.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2004-12-05 01:03:15 +0000
committerDr. Stephen Henson <steve@openssl.org>2004-12-05 01:03:15 +0000
commita0e7c8eede26b29b09057f48b8e51f46f8811ddd (patch)
tree2b50575b4e9e608b61cb74246915625bd99b85d8 /crypto/asn1/a_digest.c
parenta8e00b17ce840c58787e45411fa2ac4d6b1fb10c (diff)
downloadopenssl-a0e7c8eede26b29b09057f48b8e51f46f8811ddd.tar.gz
Add lots of checks for memory allocation failure, error codes to indicate
failure and freeing up memory if a failure occurs. PR:620
Diffstat (limited to 'crypto/asn1/a_digest.c')
-rw-r--r--crypto/asn1/a_digest.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/asn1/a_digest.c b/crypto/asn1/a_digest.c
index 4931e222a0..7182e9fa5d 100644
--- a/crypto/asn1/a_digest.c
+++ b/crypto/asn1/a_digest.c
@@ -65,6 +65,7 @@
# include <sys/types.h>
#endif
+#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/buffer.h>
#include <openssl/x509.h>
@@ -78,7 +79,11 @@ int ASN1_digest(int (*i2d)(), const EVP_MD *type, char *data,
unsigned char *str,*p;
i=i2d(data,NULL);
- if ((str=(unsigned char *)OPENSSL_malloc(i)) == NULL) return(0);
+ if ((str=(unsigned char *)OPENSSL_malloc(i)) == NULL)
+ {
+ ASN1err(ASN1_F_ASN1_DIGEST,ERR_R_MALLOC_FAILURE);
+ return(0);
+ }
p=str;
i2d(data,&p);