fix potential memory leak when allocation fails
authorBodo Möller <bodo@openssl.org>
Fri, 11 Mar 2005 09:01:24 +0000 (09:01 +0000)
committerBodo Möller <bodo@openssl.org>
Fri, 11 Mar 2005 09:01:24 +0000 (09:01 +0000)
PR: 801
Submitted by: Nils Larsch

crypto/pem/pem_lib.c

index 81c4aba..ae0a87e 100644 (file)
@@ -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);
                }