There have been a number of complaints from a number of sources that names
like Malloc, Realloc and especially Free conflict with already existing names
on some operating systems or other packages. That is reason enough to change
the names of the OpenSSL memory allocation macros to something that has a
better chance of being unique, like prepending them with OPENSSL_.
This change includes all the name changes needed throughout all C files.
diff --git a/apps/apps.c b/apps/apps.c
index a87d23b..f063d83 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -91,8 +91,8 @@
*argv=NULL;
len=(unsigned int)stbuf.st_size;
- if (buf != NULL) Free(buf);
- buf=(char *)Malloc(len+1);
+ if (buf != NULL) OPENSSL_free(buf);
+ buf=(char *)OPENSSL_malloc(len+1);
if (buf == NULL) return(0);
len=fread(buf,1,len,fp);
@@ -102,8 +102,8 @@
i=0;
for (p=buf; *p; p++)
if (*p == '\n') i++;
- if (arg != NULL) Free(arg);
- arg=(char **)Malloc(sizeof(char *)*(i*2));
+ if (arg != NULL) OPENSSL_free(arg);
+ arg=(char **)OPENSSL_malloc(sizeof(char *)*(i*2));
*argv=arg;
num=0;
@@ -266,7 +266,7 @@
if (arg->count == 0)
{
arg->count=20;
- arg->data=(char **)Malloc(sizeof(char *)*arg->count);
+ arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count);
}
for (i=0; i<arg->count; i++)
arg->data[i]=NULL;
@@ -285,7 +285,7 @@
if (num >= arg->count)
{
arg->count+=20;
- arg->data=(char **)Realloc(arg->data,
+ arg->data=(char **)OPENSSL_realloc(arg->data,
sizeof(char *)*arg->count);
if (argc == 0) return(0);
}
diff --git a/apps/asn1pars.c b/apps/asn1pars.c
index f104ebc..2d64492 100644
--- a/apps/asn1pars.c
+++ b/apps/asn1pars.c
@@ -108,7 +108,7 @@
argv++;
if ((osk=sk_new_null()) == NULL)
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto end;
}
while (argc >= 1)
diff --git a/apps/ca.c b/apps/ca.c
index 62747ec..6935265 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -808,7 +808,7 @@
{
if ((f=BN_bn2hex(serial)) == NULL) goto err;
BIO_printf(bio_err,"next serial number is %s\n",f);
- Free(f);
+ OPENSSL_free(f);
}
if ((attribs=CONF_get_section(conf,policy)) == NULL)
@@ -819,7 +819,7 @@
if ((cert_sk=sk_X509_new_null()) == NULL)
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto err;
}
if (spkac_file != NULL)
@@ -836,7 +836,7 @@
if (!BN_add_word(serial,1)) goto err;
if (!sk_X509_push(cert_sk,x))
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto err;
}
if (outfile)
@@ -860,7 +860,7 @@
if (!BN_add_word(serial,1)) goto err;
if (!sk_X509_push(cert_sk,x))
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto err;
}
}
@@ -879,7 +879,7 @@
if (!BN_add_word(serial,1)) goto err;
if (!sk_X509_push(cert_sk,x))
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto err;
}
}
@@ -898,7 +898,7 @@
if (!BN_add_word(serial,1)) goto err;
if (!sk_X509_push(cert_sk,x))
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto err;
}
}
@@ -1580,7 +1580,7 @@
/* Ok, now we check the 'policy' stuff. */
if ((subject=X509_NAME_new()) == NULL)
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto err;
}
@@ -1678,7 +1678,7 @@
{
if (push != NULL)
X509_NAME_ENTRY_free(push);
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto err;
}
}
@@ -1700,7 +1700,7 @@
row[DB_serial]=BN_bn2hex(serial);
if ((row[DB_name] == NULL) || (row[DB_serial] == NULL))
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto err;
}
@@ -1841,32 +1841,32 @@
goto err;
/* We now just add it to the database */
- row[DB_type]=(char *)Malloc(2);
+ row[DB_type]=(char *)OPENSSL_malloc(2);
tm=X509_get_notAfter(ret);
- row[DB_exp_date]=(char *)Malloc(tm->length+1);
+ row[DB_exp_date]=(char *)OPENSSL_malloc(tm->length+1);
memcpy(row[DB_exp_date],tm->data,tm->length);
row[DB_exp_date][tm->length]='\0';
row[DB_rev_date]=NULL;
/* row[DB_serial] done already */
- row[DB_file]=(char *)Malloc(8);
+ row[DB_file]=(char *)OPENSSL_malloc(8);
/* row[DB_name] done already */
if ((row[DB_type] == NULL) || (row[DB_exp_date] == NULL) ||
(row[DB_file] == NULL))
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto err;
}
strcpy(row[DB_file],"unknown");
row[DB_type][0]='V';
row[DB_type][1]='\0';
- if ((irow=(char **)Malloc(sizeof(char *)*(DB_NUMBER+1))) == NULL)
+ if ((irow=(char **)OPENSSL_malloc(sizeof(char *)*(DB_NUMBER+1))) == NULL)
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto err;
}
@@ -1886,7 +1886,7 @@
ok=1;
err:
for (i=0; i<DB_NUMBER; i++)
- if (row[i] != NULL) Free(row[i]);
+ if (row[i] != NULL) OPENSSL_free(row[i]);
if (CAname != NULL)
X509_NAME_free(CAname);
@@ -2137,7 +2137,7 @@
BN_free(bn);
if ((row[DB_name] == NULL) || (row[DB_serial] == NULL))
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto err;
}
/* We have to lookup by serial number because name lookup
@@ -2149,33 +2149,33 @@
BIO_printf(bio_err,"Adding Entry to DB for %s\n", row[DB_name]);
/* We now just add it to the database */
- row[DB_type]=(char *)Malloc(2);
+ row[DB_type]=(char *)OPENSSL_malloc(2);
tm=X509_get_notAfter(x509);
- row[DB_exp_date]=(char *)Malloc(tm->length+1);
+ row[DB_exp_date]=(char *)OPENSSL_malloc(tm->length+1);
memcpy(row[DB_exp_date],tm->data,tm->length);
row[DB_exp_date][tm->length]='\0';
row[DB_rev_date]=NULL;
/* row[DB_serial] done already */
- row[DB_file]=(char *)Malloc(8);
+ row[DB_file]=(char *)OPENSSL_malloc(8);
/* row[DB_name] done already */
if ((row[DB_type] == NULL) || (row[DB_exp_date] == NULL) ||
(row[DB_file] == NULL))
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto err;
}
strcpy(row[DB_file],"unknown");
row[DB_type][0]='V';
row[DB_type][1]='\0';
- if ((irow=(char **)Malloc(sizeof(char *)*(DB_NUMBER+1))) == NULL)
+ if ((irow=(char **)OPENSSL_malloc(sizeof(char *)*(DB_NUMBER+1))) == NULL)
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto err;
}
@@ -2218,7 +2218,7 @@
revtm=X509_gmtime_adj(revtm,0);
rrow[DB_type][0]='R';
rrow[DB_type][1]='\0';
- rrow[DB_rev_date]=(char *)Malloc(revtm->length+1);
+ rrow[DB_rev_date]=(char *)OPENSSL_malloc(revtm->length+1);
memcpy(rrow[DB_rev_date],revtm->data,revtm->length);
rrow[DB_rev_date][revtm->length]='\0';
ASN1_UTCTIME_free(revtm);
@@ -2228,7 +2228,7 @@
for (i=0; i<DB_NUMBER; i++)
{
if (row[i] != NULL)
- Free(row[i]);
+ OPENSSL_free(row[i]);
}
return(ok);
}
diff --git a/apps/crl2p7.c b/apps/crl2p7.c
index 4056591..ebf5fe9 100644
--- a/apps/crl2p7.c
+++ b/apps/crl2p7.c
@@ -220,7 +220,7 @@
if (crl != NULL)
{
sk_X509_CRL_push(crl_stack,crl);
- crl=NULL; /* now part of p7 for Freeing */
+ crl=NULL; /* now part of p7 for OPENSSL_freeing */
}
if ((cert_stack=sk_X509_new(NULL)) == NULL) goto end;
@@ -327,7 +327,7 @@
ret=count;
end:
- /* never need to Free x */
+ /* never need to OPENSSL_free x */
if (in != NULL) BIO_free(in);
if (sk != NULL) sk_X509_INFO_free(sk);
return(ret);
diff --git a/apps/dgst.c b/apps/dgst.c
index 1b56d6e..3db28d2 100644
--- a/apps/dgst.c
+++ b/apps/dgst.c
@@ -92,7 +92,7 @@
apps_startup();
- if ((buf=(unsigned char *)Malloc(BUFSIZE)) == NULL)
+ if ((buf=(unsigned char *)OPENSSL_malloc(BUFSIZE)) == NULL)
{
BIO_printf(bio_err,"out of memory\n");
goto end;
@@ -192,7 +192,7 @@
if (buf != NULL)
{
memset(buf,0,BUFSIZE);
- Free(buf);
+ OPENSSL_free(buf);
}
if (in != NULL) BIO_free(in);
if (bmd != NULL) BIO_free(bmd);
diff --git a/apps/dh.c b/apps/dh.c
index 674963f..ee71d95 100644
--- a/apps/dh.c
+++ b/apps/dh.c
@@ -251,10 +251,10 @@
len=BN_num_bytes(dh->p);
bits=BN_num_bits(dh->p);
- data=(unsigned char *)Malloc(len);
+ data=(unsigned char *)OPENSSL_malloc(len);
if (data == NULL)
{
- perror("Malloc");
+ perror("OPENSSL_malloc");
goto end;
}
l=BN_bn2bin(dh->p,data);
@@ -285,7 +285,7 @@
printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
printf("\t\treturn(NULL);\n");
printf("\treturn(dh);\n\t}\n");
- Free(data);
+ OPENSSL_free(data);
}
diff --git a/apps/dhparam.c b/apps/dhparam.c
index 709547f..f570f5f 100644
--- a/apps/dhparam.c
+++ b/apps/dhparam.c
@@ -432,10 +432,10 @@
len=BN_num_bytes(dh->p);
bits=BN_num_bits(dh->p);
- data=(unsigned char *)Malloc(len);
+ data=(unsigned char *)OPENSSL_malloc(len);
if (data == NULL)
{
- perror("Malloc");
+ perror("OPENSSL_malloc");
goto end;
}
printf("#ifndef HEADER_DH_H\n"
@@ -472,7 +472,7 @@
if (dh->length)
printf("\tdh->length = %d;\n", dh->length);
printf("\treturn(dh);\n\t}\n");
- Free(data);
+ OPENSSL_free(data);
}
diff --git a/apps/dsa.c b/apps/dsa.c
index 4977671..842e0c0 100644
--- a/apps/dsa.c
+++ b/apps/dsa.c
@@ -283,8 +283,8 @@
if(in != NULL) BIO_free(in);
if(out != NULL) BIO_free(out);
if(dsa != NULL) DSA_free(dsa);
- if(passin) Free(passin);
- if(passout) Free(passout);
+ if(passin) OPENSSL_free(passin);
+ if(passout) OPENSSL_free(passout);
EXIT(ret);
}
#endif
diff --git a/apps/dsaparam.c b/apps/dsaparam.c
index 4d4e1ad..a15d6ea 100644
--- a/apps/dsaparam.c
+++ b/apps/dsaparam.c
@@ -260,10 +260,10 @@
bits_p=BN_num_bits(dsa->p);
bits_q=BN_num_bits(dsa->q);
bits_g=BN_num_bits(dsa->g);
- data=(unsigned char *)Malloc(len+20);
+ data=(unsigned char *)OPENSSL_malloc(len+20);
if (data == NULL)
{
- perror("Malloc");
+ perror("OPENSSL_malloc");
goto end;
}
l=BN_bn2bin(dsa->p,data);
diff --git a/apps/enc.c b/apps/enc.c
index 6531c58..49338ac 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -343,11 +343,11 @@
if (verbose) BIO_printf(bio_err,"bufsize=%d\n",bsize);
}
- strbuf=Malloc(SIZE);
- buff=(unsigned char *)Malloc(EVP_ENCODE_LENGTH(bsize));
+ strbuf=OPENSSL_malloc(SIZE);
+ buff=(unsigned char *)OPENSSL_malloc(EVP_ENCODE_LENGTH(bsize));
if ((buff == NULL) || (strbuf == NULL))
{
- BIO_printf(bio_err,"Malloc failure %ld\n",(long)EVP_ENCODE_LENGTH(bsize));
+ BIO_printf(bio_err,"OPENSSL_malloc failure %ld\n",(long)EVP_ENCODE_LENGTH(bsize));
goto end;
}
@@ -581,13 +581,13 @@
}
end:
ERR_print_errors(bio_err);
- if (strbuf != NULL) Free(strbuf);
- if (buff != NULL) Free(buff);
+ if (strbuf != NULL) OPENSSL_free(strbuf);
+ if (buff != NULL) OPENSSL_free(buff);
if (in != NULL) BIO_free(in);
if (out != NULL) BIO_free(out);
if (benc != NULL) BIO_free(benc);
if (b64 != NULL) BIO_free(b64);
- if(pass) Free(pass);
+ if(pass) OPENSSL_free(pass);
EXIT(ret);
}
diff --git a/apps/gendsa.c b/apps/gendsa.c
index b1a1c4f..1937613 100644
--- a/apps/gendsa.c
+++ b/apps/gendsa.c
@@ -211,7 +211,7 @@
if (in != NULL) BIO_free(in);
if (out != NULL) BIO_free(out);
if (dsa != NULL) DSA_free(dsa);
- if(passout) Free(passout);
+ if(passout) OPENSSL_free(passout);
EXIT(ret);
}
#endif
diff --git a/apps/genrsa.c b/apps/genrsa.c
index 6fe578d..4cbccf8 100644
--- a/apps/genrsa.c
+++ b/apps/genrsa.c
@@ -213,7 +213,7 @@
err:
if (rsa != NULL) RSA_free(rsa);
if (out != NULL) BIO_free(out);
- if(passout) Free(passout);
+ if(passout) OPENSSL_free(passout);
if (ret != 0)
ERR_print_errors(bio_err);
EXIT(ret);
diff --git a/apps/openssl.c b/apps/openssl.c
index a2a2630..5f0ffa9 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -201,7 +201,7 @@
config=NULL;
}
if (prog != NULL) lh_free(prog);
- if (arg.data != NULL) Free(arg.data);
+ if (arg.data != NULL) OPENSSL_free(arg.data);
ERR_remove_state(0);
EVP_cleanup();
diff --git a/apps/passwd.c b/apps/passwd.c
index 4650ea5..e991fef 100644
--- a/apps/passwd.c
+++ b/apps/passwd.c
@@ -200,7 +200,7 @@
passwd_malloc_size = pw_maxlen + 2;
/* longer than necessary so that we can warn about truncation */
- passwd = passwd_malloc = Malloc(passwd_malloc_size);
+ passwd = passwd_malloc = OPENSSL_malloc(passwd_malloc_size);
if (passwd_malloc == NULL)
goto err;
}
@@ -266,9 +266,9 @@
err:
ERR_print_errors(bio_err);
if (salt_malloc)
- Free(salt_malloc);
+ OPENSSL_free(salt_malloc);
if (passwd_malloc)
- Free(passwd_malloc);
+ OPENSSL_free(passwd_malloc);
if (in)
BIO_free(in);
if (out)
@@ -399,7 +399,7 @@
{
if (*salt_malloc_p == NULL)
{
- *salt_p = *salt_malloc_p = Malloc(3);
+ *salt_p = *salt_malloc_p = OPENSSL_malloc(3);
if (*salt_malloc_p == NULL)
goto err;
}
@@ -422,7 +422,7 @@
if (*salt_malloc_p == NULL)
{
- *salt_p = *salt_malloc_p = Malloc(9);
+ *salt_p = *salt_malloc_p = OPENSSL_malloc(9);
if (*salt_malloc_p == NULL)
goto err;
}
diff --git a/apps/pkcs12.c b/apps/pkcs12.c
index a45b2da..3f95894 100644
--- a/apps/pkcs12.c
+++ b/apps/pkcs12.c
@@ -565,8 +565,8 @@
#endif
BIO_free(in);
BIO_free(out);
- if(passin) Free(passin);
- if(passout) Free(passout);
+ if(passin) OPENSSL_free(passin);
+ if(passout) OPENSSL_free(passout);
EXIT(ret);
}
@@ -774,7 +774,7 @@
value = uni2asc(av->value.bmpstring->data,
av->value.bmpstring->length);
BIO_printf(out, "%s\n", value);
- Free(value);
+ OPENSSL_free(value);
break;
case V_ASN1_OCTET_STRING:
diff --git a/apps/pkcs8.c b/apps/pkcs8.c
index 3e59b74..b0914cd 100644
--- a/apps/pkcs8.c
+++ b/apps/pkcs8.c
@@ -254,8 +254,8 @@
PKCS8_PRIV_KEY_INFO_free (p8inf);
EVP_PKEY_free(pkey);
BIO_free(out);
- if(passin) Free(passin);
- if(passout) Free(passout);
+ if(passin) OPENSSL_free(passin);
+ if(passout) OPENSSL_free(passout);
return (0);
}
@@ -338,8 +338,8 @@
EVP_PKEY_free(pkey);
BIO_free(out);
BIO_free(in);
- if(passin) Free(passin);
- if(passout) Free(passout);
+ if(passin) OPENSSL_free(passin);
+ if(passout) OPENSSL_free(passout);
return (0);
}
diff --git a/apps/req.c b/apps/req.c
index eb338ee..dd37694 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -878,8 +878,8 @@
EVP_PKEY_free(pkey);
X509_REQ_free(req);
X509_free(x509ss);
- if(passargin && passin) Free(passin);
- if(passargout && passout) Free(passout);
+ if(passargin && passin) OPENSSL_free(passin);
+ if(passargout && passout) OPENSSL_free(passout);
OBJ_cleanup();
#ifndef NO_DSA
if (dsa_params != NULL) DSA_free(dsa_params);
diff --git a/apps/rsa.c b/apps/rsa.c
index 9d4c2e6..1269f65 100644
--- a/apps/rsa.c
+++ b/apps/rsa.c
@@ -345,15 +345,15 @@
i=1;
size=i2d_Netscape_RSA(rsa,NULL,NULL);
- if ((p=(unsigned char *)Malloc(size)) == NULL)
+ if ((p=(unsigned char *)OPENSSL_malloc(size)) == NULL)
{
- BIO_printf(bio_err,"Malloc failure\n");
+ BIO_printf(bio_err,"Memory allocation failure\n");
goto end;
}
pp=p;
i2d_Netscape_RSA(rsa,&p,NULL);
BIO_write(out,(char *)pp,size);
- Free(pp);
+ OPENSSL_free(pp);
}
#endif
else if (outformat == FORMAT_PEM) {
@@ -376,8 +376,8 @@
if(in != NULL) BIO_free(in);
if(out != NULL) BIO_free(out);
if(rsa != NULL) RSA_free(rsa);
- if(passin) Free(passin);
- if(passout) Free(passout);
+ if(passin) OPENSSL_free(passin);
+ if(passout) OPENSSL_free(passout);
EXIT(ret);
}
#else /* !NO_RSA */
diff --git a/apps/s_client.c b/apps/s_client.c
index 277417e..c935317 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -201,8 +201,8 @@
if (bio_err == NULL)
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
- if ( ((cbuf=Malloc(BUFSIZZ)) == NULL) ||
- ((sbuf=Malloc(BUFSIZZ)) == NULL))
+ if ( ((cbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) ||
+ ((sbuf=OPENSSL_malloc(BUFSIZZ)) == NULL))
{
BIO_printf(bio_err,"out of memory\n");
goto end;
@@ -753,8 +753,8 @@
if (con != NULL) SSL_free(con);
if (con2 != NULL) SSL_free(con2);
if (ctx != NULL) SSL_CTX_free(ctx);
- if (cbuf != NULL) { memset(cbuf,0,BUFSIZZ); Free(cbuf); }
- if (sbuf != NULL) { memset(sbuf,0,BUFSIZZ); Free(sbuf); }
+ if (cbuf != NULL) { memset(cbuf,0,BUFSIZZ); OPENSSL_free(cbuf); }
+ if (sbuf != NULL) { memset(sbuf,0,BUFSIZZ); OPENSSL_free(sbuf); }
if (bio_c_out != NULL)
{
BIO_free(bio_c_out);
diff --git a/apps/s_server.c b/apps/s_server.c
index af19b89..b593283 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -285,7 +285,7 @@
{
EBCDIC_OUTBUFF *wbuf;
- wbuf = (EBCDIC_OUTBUFF *)Malloc(sizeof(EBCDIC_OUTBUFF) + 1024);
+ wbuf = (EBCDIC_OUTBUFF *)OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + 1024);
wbuf->alloced = 1024;
wbuf->buff[0] = '\0';
@@ -299,7 +299,7 @@
{
if (a == NULL) return(0);
if (a->ptr != NULL)
- Free(a->ptr);
+ OPENSSL_free(a->ptr);
a->ptr=NULL;
a->init=0;
a->flags=0;
@@ -336,8 +336,8 @@
num = num + num; /* double the size */
if (num < inl)
num = inl;
- Free(wbuf);
- wbuf=(EBCDIC_OUTBUFF *)Malloc(sizeof(EBCDIC_OUTBUFF) + num);
+ OPENSSL_free(wbuf);
+ wbuf=(EBCDIC_OUTBUFF *)OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + num);
wbuf->alloced = num;
wbuf->buff[0] = '\0';
@@ -766,7 +766,7 @@
struct timeval tv;
#endif
- if ((buf=Malloc(bufsize)) == NULL)
+ if ((buf=OPENSSL_malloc(bufsize)) == NULL)
{
BIO_printf(bio_err,"out of memory\n");
goto err;
@@ -1028,7 +1028,7 @@
if (buf != NULL)
{
memset(buf,0,bufsize);
- Free(buf);
+ OPENSSL_free(buf);
}
if (ret >= 0)
BIO_printf(bio_s_out,"ACCEPT\n");
@@ -1145,7 +1145,7 @@
BIO *io,*ssl_bio,*sbio;
long total_bytes;
- buf=Malloc(bufsize);
+ buf=OPENSSL_malloc(bufsize);
if (buf == NULL) return(0);
io=BIO_new(BIO_f_buffer());
ssl_bio=BIO_new(BIO_f_ssl());
@@ -1474,7 +1474,7 @@
if (ret >= 0)
BIO_printf(bio_s_out,"ACCEPT\n");
- if (buf != NULL) Free(buf);
+ if (buf != NULL) OPENSSL_free(buf);
if (io != NULL) BIO_free_all(io);
/* if (ssl_bio != NULL) BIO_free(ssl_bio);*/
return(ret);
diff --git a/apps/s_socket.c b/apps/s_socket.c
index 081b1a5..0238566 100644
--- a/apps/s_socket.c
+++ b/apps/s_socket.c
@@ -241,7 +241,7 @@
return(0);
}
i=(*cb)(name,sock, context);
- if (name != NULL) Free(name);
+ if (name != NULL) OPENSSL_free(name);
SHUTDOWN2(sock);
if (i < 0)
{
@@ -372,9 +372,9 @@
}
else
{
- if ((*host=(char *)Malloc(strlen(h1->h_name)+1)) == NULL)
+ if ((*host=(char *)OPENSSL_malloc(strlen(h1->h_name)+1)) == NULL)
{
- perror("Malloc");
+ perror("OPENSSL_malloc");
return(0);
}
strcpy(*host,h1->h_name);
diff --git a/apps/smime.c b/apps/smime.c
index 7dc66d6..e2fc828 100644
--- a/apps/smime.c
+++ b/apps/smime.c
@@ -443,7 +443,7 @@
BIO_free(in);
BIO_free(indata);
BIO_free(out);
- if(passin) Free(passin);
+ if(passin) OPENSSL_free(passin);
return (ret);
}
diff --git a/apps/speed.c b/apps/speed.c
index f7a8e00..163d523 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -362,7 +362,7 @@
rsa_key[i]=NULL;
#endif
- if ((buf=(unsigned char *)Malloc((int)BUFSIZE)) == NULL)
+ if ((buf=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL)
{
BIO_printf(bio_err,"out of memory\n");
goto end;
@@ -370,7 +370,7 @@
#ifndef NO_DES
buf_as_des_cblock = (des_cblock *)buf;
#endif
- if ((buf2=(unsigned char *)Malloc((int)BUFSIZE)) == NULL)
+ if ((buf2=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL)
{
BIO_printf(bio_err,"out of memory\n");
goto end;
@@ -1173,8 +1173,8 @@
#endif
mret=0;
end:
- if (buf != NULL) Free(buf);
- if (buf2 != NULL) Free(buf2);
+ if (buf != NULL) OPENSSL_free(buf);
+ if (buf2 != NULL) OPENSSL_free(buf2);
#ifndef NO_RSA
for (i=0; i<RSA_NUM; i++)
if (rsa_key[i] != NULL)
diff --git a/apps/spkac.c b/apps/spkac.c
index f3ee7e3..ad45c2d 100644
--- a/apps/spkac.c
+++ b/apps/spkac.c
@@ -200,7 +200,7 @@
goto end;
}
BIO_printf(out, "SPKAC=%s\n", spkstr);
- Free(spkstr);
+ OPENSSL_free(spkstr);
ret = 0;
goto end;
}
@@ -271,6 +271,6 @@
BIO_free(out);
BIO_free(key);
EVP_PKEY_free(pkey);
- if(passin) Free(passin);
+ if(passin) OPENSSL_free(passin);
EXIT(ret);
}
diff --git a/apps/x509.c b/apps/x509.c
index 0184c62..88ef1e0 100644
--- a/apps/x509.c
+++ b/apps/x509.c
@@ -696,7 +696,7 @@
BIO_printf(STDout,"/* issuer :%s */\n",buf);
z=i2d_X509(x,NULL);
- m=Malloc(z);
+ m=OPENSSL_malloc(z);
d=(unsigned char *)m;
z=i2d_X509_NAME(X509_get_subject_name(x),&d);
@@ -734,7 +734,7 @@
if (y%16 != 0) BIO_printf(STDout,"\n");
BIO_printf(STDout,"};\n");
- Free(m);
+ OPENSSL_free(m);
}
else if (text == i)
{
@@ -917,7 +917,7 @@
X509_REQ_free(rq);
sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
- if(passin) Free(passin);
+ if(passin) OPENSSL_free(passin);
EXIT(ret);
}
@@ -939,7 +939,7 @@
EVP_PKEY_free(upkey);
X509_STORE_CTX_init(&xsc,ctx,x,NULL);
- buf=Malloc(EVP_PKEY_size(pkey)*2+
+ buf=OPENSSL_malloc(EVP_PKEY_size(pkey)*2+
((serialfile == NULL)
?(strlen(CAfile)+strlen(POSTFIX)+1)
:(strlen(serialfile)))+1);
@@ -1062,7 +1062,7 @@
X509_STORE_CTX_cleanup(&xsc);
if (!ret)
ERR_print_errors(bio_err);
- if (buf != NULL) Free(buf);
+ if (buf != NULL) OPENSSL_free(buf);
if (bs != NULL) ASN1_INTEGER_free(bs);
if (io != NULL) BIO_free(io);
if (serial != NULL) BN_free(serial);