malloc/free issuse again.

Trying to build openssl libraries without a reference to malloc/free/realloc
(compiling with -DMFUNC) and need to get rid of a few left-over references to
'free' and 'malloc'. The reason for this is that I need to have a special set
of memory functions since the standard ones are process specific and are
auto-freed once a process dies (mentioned earlier). Besides, references
to malloc/free's drags in my compiler's malloc/free packet which I want
to avoid as well.

I realize the 'reason' for using the malloc instead of Malloc in enc_writ.c
and enc_read.c could be to lessen the spam in the CRYPTO_mem_leaks print'out.
But if that is the reason, I suggest declaring a new set of macros for such
use.

The patch included gets rid of 4 references to malloc (also mentioned before)
and 1 reference to free. There are still 5 references left in mem.c used for
the static initialization of the malloc/free funcs in which I am not sure what
you want do do with? I added 'crypto' in front of them and made a set of
cryptoxxx stubs.

/Lennart Bang
TCP/IP knudel
[EMAIL PROTECTED]

ps: I realize you got a hectic time-schedule due to the 0.9.2 so I dont
really expect you to enter this asap but please at least give a short
'ok' so I know I if I can expect them later or if I have to add them to
my own prepare scripts (want to automate updates).


diff -ru3 openssl-SNAP-19990312-1530-org/crypto/des/enc_read.c 
openssl-SNAP-19990312-1530-mod/crypto/des/enc_read.c
--- openssl-SNAP-19990312-1530-org/crypto/des/enc_read.c        Sat Feb 13 20:00:06 
1999
+++ openssl-SNAP-19990312-1530-mod/crypto/des/enc_read.c        Sat Mar 13 14:21:53 
+1999
@@ -87,17 +87,17 @@
 
        if (tmpbuf == NULL)
                {
-               tmpbuf=(char *)malloc(BSIZE);
+               tmpbuf=(char *)Malloc(BSIZE);
                if (tmpbuf == NULL) return(-1);
                }
        if (net == NULL)
                {
-               net=(unsigned char *)malloc(BSIZE);
+               net=(unsigned char *)Malloc(BSIZE);
                if (net == NULL) return(-1);
                }
        if (unnet == NULL)
                {
-               unnet=(char *)malloc(BSIZE);
+               unnet=(char *)Malloc(BSIZE);
                if (unnet == NULL) return(-1);
                }
        /* left over data from last decrypt */
diff -ru3 openssl-SNAP-19990312-1530-org/crypto/des/enc_writ.c 
openssl-SNAP-19990312-1530-mod/crypto/des/enc_writ.c
--- openssl-SNAP-19990312-1530-org/crypto/des/enc_writ.c        Sat Feb 13 20:00:06 
1999
+++ openssl-SNAP-19990312-1530-mod/crypto/des/enc_writ.c        Sat Mar 13 14:23:26 
+1999
@@ -84,7 +84,7 @@
 
        if (outbuf == NULL)
                {
-               outbuf=(char *)malloc(BSIZE+HDRSIZE);
+               outbuf=(char *)Malloc(BSIZE+HDRSIZE);
                if (outbuf == NULL) return(-1);
                }
        /* If we are sending less than 8 bytes, the same char will look
diff -ru3 openssl-SNAP-19990312-1530-org/ssl/ssl_lib.c 
openssl-SNAP-19990312-1530-mod/ssl/ssl_lib.c
--- openssl-SNAP-19990312-1530-org/ssl/ssl_lib.c        Sat Mar  6 16:00:18 1999
+++ openssl-SNAP-19990312-1530-mod/ssl/ssl_lib.c        Sat Mar 13 14:19:55 1999
@@ -1019,7 +1019,7 @@
        if (a->extra_certs != NULL)
                sk_pop_free(a->extra_certs,X509_free);
        if (a->comp_methods != NULL)
-               sk_pop_free(a->comp_methods,free);
+               sk_pop_free(a->comp_methods,FreeFunc);
        Free((char *)a);
        }

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to