[PATCH] Fix new Coverity IDs

Stefan Metzmacher metze at samba.org
Thu Jan 12 07:45:58 UTC 2017


Hi Jeremy,

>>> - 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).

The talloc_get_size() change is ok.

For the others please use

if (prids != NULL) {
	*prids = NULL;
}

at the beginning and

if (prids != NULL) {
	*prids = rids;
}

at the end or

*prids = NULL

at the beginning and

*prids = rids;

at the end.

But doing just

if (prids) {
	*prids = rids;
}

is ugly and you're the one who always preach
that we should not leave pointers uninitialized,
so I think we should always set it to NULL at the
beginning.

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170112/648a51f2/signature.sig>


More information about the samba-technical mailing list