svn commit: samba r11705 - in branches/SAMBA_4_0/source/libnet: .

John L.Utz III jutz at centeris.com
Mon Nov 14 17:17:39 GMT 2005


At Sun, 13 Nov 2005 23:08:30 +0100,
Rafal Szczesniak wrote:
> 
> [1  <text/plain; iso-8859-2 (quoted-printable)>]
> On Mon, Nov 14, 2005 at 08:39:51AM +1100, Andrew Bartlett wrote:
> > On Sun, 2005-11-13 at 22:36 +0100, Rafal Szczesniak wrote:
> > > On Mon, Nov 14, 2005 at 08:05:07AM +1100, Andrew Bartlett wrote:
> > > > On Sun, 2005-11-13 at 19:38 +0100, Rafal Szczesniak wrote:
> > > > > On Sun, Nov 13, 2005 at 02:12:56PM +0100, Stefan Metzmacher wrote:
> > 
> > > > > > why an array of 8 characters? and why the caller need to set the out parameter?
> > > > > 
> > > > > I'm sorry, this is mistake. It should be long enough to store ip
> > > > > address. Thanks for catching that.
> > > > > Address argument is just like [ref] - you have to pass a
> > > > > pointer to allocated buffer for function to fill in the result.
> > > > > Otherwise resolve_name function segfaults.
> > > > 
> > > > I really don't think we want those semantics in libnet.  Why can't
> > > > libnet_LookupPdc do the allocation?
> > > 
> > > Sure it can. I just followed what resolve_name required, but I don't
> > > mind changing that :)
> > 
> > I'm not entirely sure what you mean here:  Perhaps post your proposed
> > change to the list?
> 
> I just mean chaning behaviour of libnet_LookupPdc so that it allocates
> the buffer and returns it with proper ip address. This means no
> requirement to pass allocated buffer to the function as it takes care
> of it itself.
> 
> It is really quite small change. I don't want to touch resolve_name
> part.

Is there a standard in the samba src tree for buffers like this?

is it traditional to do have the callee do the malloc?

or is it contributor dependent? :-)

My next comment might be incorrect due to my ignorance of some of the
utility functionality in samba pertaining to memory management, but
i'd rather ask the question and be corrected then to just let this
lie:

Wouldnt it be better if the callee's made the callers do the malloc so that
the callers would be less likely to forget to free things?

tnx!


> cheers,
> -- 
> Rafal Szczesniak
> Samba Team member  http://www.samba.org
> 
> [2 Digital signature <application/pgp-signature (7bit)>]
> 


More information about the samba-technical mailing list