[RFC PATCH] data_blob_realloc() accept 0 length argument

Andrew Bartlett abartlet at samba.org
Fri Feb 16 02:47:40 UTC 2018

On Fri, 2018-02-16 at 03:24 +0100, Timur I. Bakeyev via samba-technical 
> Hi all!
> I was debugging one of our VFS modules and figured out that the code fails
> when data_blob_realloc() receives a 0 as a length argument. For me, passing
> 0, although seems to be useless, but still a valid invocation of the
> function.
> Apparently, guys from the SSSD team also think so
> https://pagure.io/SSSD/sssd/issue/2369.
> What do you think about similar fix for the data_blob_talloc()?

That matches the behaviour of talloc_realloc(), which is indeed for
realloc to zero length to be free.  

This can be confusing, as talloc() of zero length does an allocation,
but that is the pattern.

Andrew Bartlett

> With regards,
> Timur Bakeyev.
Andrew Bartlett
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT   

More information about the samba-technical mailing list