In message <cagxgq09umap5b1bhsyjj54srwrg-syzqnodk5rh_gnt29xa...@mail.gmail.com> 
on Thu, 24 May 2012 17:46:49 +0530, Sudarshan Raghavan 
<sudarshan.t.ragha...@gmail.com> said:

sudarshan.t.raghavan> Hi,
sudarshan.t.raghavan> 
sudarshan.t.raghavan> I am using CRYPTO_set_mem_functions to use our own custom 
memory
sudarshan.t.raghavan> routines in a non blocking proxy implementation. This was 
working fine
sudarshan.t.raghavan> in 0.9.8 and 1.0.0 but with 1.0.1c I can see that the 
custom free
sudarshan.t.raghavan> routine is being invoked with a NULL argument after 
calling SSL_free
sudarshan.t.raghavan> and this results in the proxy crashing.
sudarshan.t.raghavan> 
sudarshan.t.raghavan> #3  0x0828bd24 in CUSTOM_FREE (oldMem=0x0) at 
custom_mem.c:340
sudarshan.t.raghavan> #4  0xb75342b4 in CRYPTO_free () from
sudarshan.t.raghavan> 
/home/product/code/firmware/current/lib/openssl1.0/lib/libcrypto.so.1.0.0
sudarshan.t.raghavan> #5  0x00000000 in ?? ()
sudarshan.t.raghavan> 
sudarshan.t.raghavan> This happens every time the SSL connections is torn down. 
If I don't
sudarshan.t.raghavan> use CRYPTO_set_mem_functions it works fine. I am assuming 
the default
sudarshan.t.raghavan> free routine ignores a NULL argument. Is it an 
expectation from the
sudarshan.t.raghavan> custom free routine to also ignore NULL? I can provide 
more
sudarshan.t.raghavan> information if needed. Can someone help me debug this 
problem.
sudarshan.t.raghavan> 
sudarshan.t.raghavan> Thanks,
sudarshan.t.raghavan> Sudarshan

Your assumption is correct, OpenSSL expects the same semantics as
malloc(), realloc() and free(), so you free() replacement must be able
to handle a NULL argument.

Cheers,
Richard

-- 
Richard Levitte                         rich...@levitte.org
                                        http://richard.levitte.org/

"Life is a tremendous celebration - and I'm invited!"
-- from a friend's blog, translated from Swedish
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to