public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Xavier Garreau <x.garreau@prim-time.fr>
To: bluez-users@lists.sourceforge.net
Subject: Re: [Bluez-users] malloc & free
Date: Wed, 06 Apr 2005 09:33:55 +0200	[thread overview]
Message-ID: <425390E3.6060408@prim-time.fr> (raw)
In-Reply-To: <42538BC5.7060106@futurlink.com>

>>>The problem with these functions is that they call malloc(), expecting 
>>>the caller to call free(). The problem with that is that this approach 
>>>is not save, as it is not guaranteed that calling malloc() in a library 
>>>function and free() in the main program works. In fact, I have seen a 
>>>segmentation fault doing that.
>>>    
>>>
>>
>>explain why this is not safe.
>>  
>>
> I am not an expert in these issues, but I have read many times that 
> there is no guarantee that the malloc/free implementation is the same in 
> the main program and in the libraries. This is due to how the different 
> modules are compiled: compiler version, compile flags, etc. But, as I 
> said, I am not 100% sure. I am quite sure that I have read this for 
> Windows, but maybe (probably) Linux is different.

Except if statically linked with the libc or if malloc and free have 
been re_#define_d, functions from the lib and the main program will uses 
the system default libc implementation.

Regards,
Xavier Garreau


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

      reply	other threads:[~2005-04-06  7:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-31 16:30 [Bluez-users] malloc & free Pedro Monjo Florit
2005-04-03 18:58 ` Marcel Holtmann
2005-04-06  7:12   ` Pedro Monjo Florit
2005-04-06  7:33     ` Xavier Garreau [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=425390E3.6060408@prim-time.fr \
    --to=x.garreau@prim-time.fr \
    --cc=bluez-users@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox