Richard Dykiel <[EMAIL PROTECTED]>:

> I tried the cleanup calls advised by Bodo, it works fine so far as OpenSSL
> is concerned; I tested the CRYPTO mem debug functions & I am now confident
> they'll spot my bugs.
> 
> However I still have the following leaks reported by Win32's debugging
> tools:
> 
> Detected memory leaks!
> Dumping objects ->
> {3409} normal block at 0x0090A8D0, 512 bytes long.
>  Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> {3447} normal block at 0x008C8758, 128 bytes long.
>  Data: <                > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> {2596} normal block at 0x008FC880, 96 bytes long.
>  Data: <    , @   @ A   > D0 A8 90 00 2C 9C 40 00 AF 9C 40 00 41 00 00 00
> {49} normal block at 0x008D1DA0, 96 bytes long.
>  Data: <X    L@  M@     > 58 87 8C 00 FC 4C 40 00 0B 4D 40 00 10 00 00 00
> Object dump complete.

These could be the data structures used by OpenSSL to keep track of
allocated memory, they are not freed.  Try with this patch to
crypto/mem_dbg.c:

Index: mem_dbg.c
===================================================================
RCS file: /usr/local/openssl/cvs/openssl/crypto/mem_dbg.c,v
retrieving revision 1.12
diff -u -u -r1.12 mem_dbg.c
--- mem_dbg.c   2000/02/11 09:47:12     1.12
+++ mem_dbg.c   2000/03/16 21:39:25
@@ -646,13 +646,18 @@
        ml.chunks=0;
        CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2);
        lh_doall_arg(mh,(void (*)())print_leak,(char *)&ml);
-       CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2);
        if (ml.chunks != 0)
                {
                sprintf(buf,"%ld bytes leaked in %d chunks\n",
                        ml.bytes,ml.chunks);
                BIO_puts(b,buf);
                }
+       else
+               {
+               lh_free(mh);
+               mh = NULL;
+               }
+       CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2);
 
 #if 0
        lh_stats_bio(mh,b);
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to