Memory leak in cephwrap_realpath (vfs_ceph.c)

Jeremy Allison jra at samba.org
Thu May 10 18:16:13 UTC 2018


On Thu, May 10, 2018 at 05:49:18PM +0000, Rungta, Vandana via samba-technical wrote:
> Because the asprintf man page says result is undefined in the error path, I initialized it to NULL.  The man page also says the error can be because memory allocation wasn't possible or some other error.  The additional SAFE_FREE was to handle the case that memory allocation succeeded but there was some other error before they returned.  
> 
> I am happy to sign off on the change.

It's safe to assume that if result is undefined in the error path,
then in the error case of asprintf it won't return allocated
memory in 'result'.

That way is a memory leak in asprintf, not the calling code.



More information about the samba-technical mailing list