From: Volker Lendecke Date: Wed, 8 Aug 2018 12:20:58 +0000 (+0200) Subject: streams_xattr: Make error handling more obvious X-Git-Tag: tdb-1.3.17~1620 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36055dbb660a1a1086e06b3849e4deb93f2a99ef;p=thirdparty%2Fsamba.git streams_xattr: Make error handling more obvious Do the NULL check right after the alloc call Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 8714007cb8d..0743959e957 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -503,6 +503,11 @@ static int streams_xattr_open(vfs_handle_struct *handle, sio->xattr_name = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(handle, fsp), xattr_name); + if (sio->xattr_name == NULL) { + errno = ENOMEM; + goto fail; + } + /* * so->base needs to be a copy of fsp->fsp_name->base_name, * making it identical to streams_xattr_recheck(). If the @@ -512,15 +517,15 @@ static int streams_xattr_open(vfs_handle_struct *handle, */ sio->base = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(handle, fsp), fsp->fsp_name->base_name); - sio->fsp_name_ptr = fsp->fsp_name; - sio->handle = handle; - sio->fsp = fsp; - - if ((sio->xattr_name == NULL) || (sio->base == NULL)) { + if (sio->base == NULL) { errno = ENOMEM; goto fail; } + sio->fsp_name_ptr = fsp->fsp_name; + sio->handle = handle; + sio->fsp = fsp; + return fakefd; fail: