Hi Pratap,

one possible reason for a memory leak is the
way you use the BN_bn2hex() function.

[...]
>                 BN_CTX_free(ctx);
>                 return;
>         }
>         strcpy((char *)A,(const char *)BN_bn2hex(d));
>
[...]

from the BN_bn2hex manpage :
       [...]
       BN_bn2hex() and BN_bn2dec() return printable strings
       containing the hexadecimal and decimal encoding of a
       respectively. For negative numbers, the string is prefaced
       with a leading '-'. The string must be freed later using
       OPENSSL_free().
       [...]

Try :
       char *buffer=NULL;
       ....
       buffer = BN_bn2hex(d);
       strcpy((char *)A, buffer);
       OPENSSL_free(buffer);
       ...

Nils

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

Reply via email to