[PATCH] Fix new Coverity IDs
Andreas Schneider
asn at samba.org
Thu Jan 12 06:46:08 UTC 2017
On Wednesday, 11 January 2017 13:07:55 CET Jeremy Allison wrote:
> On Wed, Jan 11, 2017 at 11:47:06AM -0800, Jeremy Allison wrote:
> > On Wed, Jan 11, 2017 at 11:07:18AM -0800, Jeremy Allison wrote:
> > > 1501 num_rids = talloc_array_length(rids);
> > >
> > > so 'rids' is already initialized to NULL, but we then
> > > call talloc_array_length(rids) without checking if
> > > the return was NULL. This works (I think), but goes
> > > via:
> > >
> > > #define talloc_array_length(ctx) (talloc_get_size(ctx)/sizeof(*ctx))
> > >
> > > and talloc_get_size() is:
> > >
> > > _PUBLIC_ size_t talloc_get_size(const void *context)
> > > {
> > >
> > > struct talloc_chunk *tc;
> > >
> > > if (context == NULL) {
> > >
> > > context = null_context;
> > >
> > > }
> > > if (context == NULL) {
> > >
> > > return 0;
> > >
> > > }
> > >
> > > tc = talloc_chunk_from_ptr(context);
> > >
> > > return tc->size;
> > >
> > > }
> > >
> > > - which uses null_context - which can change what it returns
> > > if someone ever calls talloc_enable_null_tracking() !!!!!
> >
> > Never mind. As Volker just pointed out to me on the phone,
> > null_context = _talloc_named_const(NULL, 0, "null_context"),
> > which will always return zero size anyway. Still,
> > that code shouldn't be in talloc_get_size().
> >
> > Patch(es) to follow !
>
> Here the are. Please review and push if happy !
>
> (Finally fixed the to: address for metze, sorry).
RB+
Pushed to autobuild!
--
Andreas Schneider GPG-ID: CC014E3D
Samba Team asn at samba.org
www.samba.org
More information about the samba-technical
mailing list