summaryrefslogtreecommitdiffstats
path: root/crypto/pem
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2005-03-11 09:01:24 +0000
committerBodo Möller <bodo@openssl.org>2005-03-11 09:01:24 +0000
commit2b61034b0b2b1a2009dab47c72438a73c5c2d9e6 (patch)
tree4336185b5d08ce10eabc46493055b4b9f9f70542 /crypto/pem
parent80c808b90b79356c37ac41ee9bf748d39b4e53e3 (diff)
fix potential memory leak when allocation fails
PR: 801 Submitted by: Nils Larsch
Diffstat (limited to 'crypto/pem')
-rw-r--r--crypto/pem/pem_lib.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c
index 81c4aba235..ae0a87e978 100644
--- a/crypto/pem/pem_lib.c
+++ b/crypto/pem/pem_lib.c
@@ -627,6 +627,9 @@ int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data,
dataB=BUF_MEM_new();
if ((nameB == NULL) || (headerB == NULL) || (dataB == NULL))
{
+ BUF_MEM_free(nameB);
+ BUF_MEM_free(headerB);
+ BUF_MEM_free(dataB);
PEMerr(PEM_F_PEM_READ_BIO,ERR_R_MALLOC_FAILURE);
return(0);
}