svn commit: samba r20150 - in branches/SAMBA_3_0/source:
nsswitch script/tests
simo
idra at samba.org
Wed Dec 13 18:26:45 GMT 2006
On Wed, 2006-12-13 at 09:41 -0800, Jeremy Allison wrote:
> On Wed, Dec 13, 2006 at 04:39:51PM +0000, idra at samba.org wrote:
> >
> > better memory handling for some functions, make sure we don't
> > leak memory by using the wrong(long lived) mem context
> >
> >
> > Modified:
> > branches/SAMBA_3_0/source/nsswitch/idmap_rid.c
> > branches/SAMBA_3_0/source/nsswitch/winbindd_async.c
> > branches/SAMBA_3_0/source/nsswitch/winbindd_group.c
> > branches/SAMBA_3_0/source/nsswitch/winbindd_util.c
> > branches/SAMBA_3_0/source/script/tests/selftest.sh
> >
> >
> > Changeset:
> > Modified: branches/SAMBA_3_0/source/nsswitch/idmap_rid.c
> > ===================================================================
> > --- branches/SAMBA_3_0/source/nsswitch/idmap_rid.c 2006-12-13 11:19:51 UTC (rev 20149)
> > +++ branches/SAMBA_3_0/source/nsswitch/idmap_rid.c 2006-12-13 16:39:50 UTC (rev 20150)
> > @@ -81,12 +81,12 @@
> > return ret;
> > }
> >
> > -static NTSTATUS idmap_rid_id_to_sid(struct idmap_rid_context *ctx, struct id_map *map)
> > +static NTSTATUS idmap_rid_id_to_sid(TALLOC_CTX *memctx, struct idmap_rid_context *ctx, struct id_map *map)
> > {
> > char *domname, *name;
> > enum lsa_SidType sid_type;
> >
> > - if (!ctx || !map) {
> > + if (!memctx || !ctx || !map) {
> > return NT_STATUS_INVALID_PARAMETER;
>
> Simo - I hate code that looks like this :
>
> if (! check all incoming parameters )
> return <error>
>
> We should just crash in this case. The correct
> place for checks on these pointers is just after the
> code that just allocated them, not every time they're
> used. That's just redundant.
>
> Can you fix this up please ? I haven't checked
> the allocation code for these yet, I just saw this
> and had to comment (sorry :-).
I don't do that a lot, and I don't think there is a chance it is needed
in fact :-)
It was more of a debugging thing anyway, and I kept using them for no
specific reason, I can just remove these checks.
Simo.
--
Simo Sorce
Samba Team GPL Compliance Officer
email: idra at samba.org
http://samba.org
More information about the samba-technical
mailing list