Hmm, i think that depends on which BN_ functions. In your example, BN_bin2bn() returns a new BIGNUM object, so you do not need to BN_new().

b l wrote:
Hi,

If i reuse a BIGNUM created with BN_new() without
freeing it first will i cause a memory leak?
does the BIGNUM dynamically allocate memory each time
it is used by certain functions?

for example
i create BIGNUM * tempBN=BN_new();

i might make a call to BN_bin2bn (char1,len,tempBN);

i might make a similar call later
BN_bin2bn(char2,len2,tempBN);

is this reuse of a big number like this going to cause
a memory leak?? Is tempBN reusing the same memory or is it allocating
new memory. How is it working internally?


Is there a faq/sample code/tips on how to use the BN
library?

At the moment i allocate a lot of BIGNUM's using
BN_new() at the start of the program. I then reuse
these BIGNUM's over and over and over throughout
multiple runs of a long computation.

I had thought that by creating them at the start of
the program and then just reusing them that i wouldn't
be repeatedly dynamically allocating memory and not
freeing it. but now i'm not so sure. Musn't the BIGNUM be
reallocating memory every time i use it otherwise how does it know what size to make itself initially?
How should i do this type of thing properly?


thanks for any help.

b








_______________________________ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]



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

Reply via email to