talloc_move - only nullify pointer if memory got "stolen"?

Andreas Schneider asn at samba.org
Thu Mar 9 12:31:19 UTC 2017


On Thursday, 9 March 2017 12:19:46 CET Stefan Metzmacher wrote:
> Am 09.03.2017 um 12:07 schrieb Uri Simchoni:
> > On 03/09/2017 12:54 PM, Stefan Metzmacher wrote:
> >> Hi Uri,
> >> 
> >>> Just came across this - is the attached patch correct / necessary?
> >> 
> >> Can you give more details? In what situation does that happen?
> >> 
> >> metze
> > 
> > I just looked at the code, no special "situation". I was wondering
> > whether I need to check the return value of talloc_move(), and what
> > happens if it fails.
> 
> talloc_steal() and talloc_move() never fail.
> 
> The doxygen comment for talloc_steal has this:
> 
>  * @return              Returns the pointer that you pass it. It does
> not have
>  *                      any failure modes.
> 
> While the comment for talloc_move() seems to be wrong:
> 
>  * @return              The pointer of the talloc chunk it has been
> moved to,
>  *                      NULL on error.
> 
> 
> talloc_guide.txt seems to be not that explicit about the return value
> of talloc_steal() and talloc_move() is completely missing.
> 
> We may want to improve the doxygen comments and talloc_guide.txt...

talloc_guide.txt is outdated since years. We should remove it.

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org



More information about the samba-technical mailing list