streams_xattr: Make error handling more obvious
authorVolker Lendecke <vl@samba.org>
Wed, 8 Aug 2018 12:20:58 +0000 (14:20 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 14 Sep 2018 05:49:14 +0000 (07:49 +0200)
Do the NULL check right after the alloc call

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_streams_xattr.c

index 0743959e9570a1cd702103523cd538efeef0ae44..30459fec4bf23c7c5ec4abc54109c109d0c3bc53 100644 (file)
@@ -190,16 +190,21 @@ static bool streams_xattr_recheck(struct stream_io *sio)
        TALLOC_FREE(sio->base);
        sio->xattr_name = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(sio->handle, sio->fsp),
                                        xattr_name);
-        sio->base = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(sio->handle, sio->fsp),
-                                  sio->fsp->fsp_name->base_name);
-       sio->fsp_name_ptr = sio->fsp->fsp_name;
-
+       if (sio->xattr_name == NULL) {
+               DBG_DEBUG("sio->xattr_name==NULL\n");
+               return false;
+       }
        TALLOC_FREE(xattr_name);
 
-       if ((sio->xattr_name == NULL) || (sio->base == NULL)) {
+       sio->base = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(sio->handle, sio->fsp),
+                                 sio->fsp->fsp_name->base_name);
+       if (sio->base == NULL) {
+               DBG_DEBUG("sio->base==NULL\n");
                return false;
        }
 
+       sio->fsp_name_ptr = sio->fsp->fsp_name;
+
        return true;
 }