]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_fruit: Make struct allocation in fruit_freaddir_attr() more common
authorVolker Lendecke <vl@samba.org>
Mon, 29 Sep 2025 12:33:18 +0000 (14:33 +0200)
committerVolker Lendecke <vl@samba.org>
Wed, 8 Oct 2025 08:01:30 +0000 (08:01 +0000)
Just assign the output buffer on success

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

index b997d810a80228c2767c7cf182ba918a4696a637..c95a3bc5e84fb4f32942705347dc44e91acd0034 100644 (file)
@@ -4487,12 +4487,11 @@ static NTSTATUS fruit_freaddir_attr(struct vfs_handle_struct *handle,
                }
        }
 
-       *pattr_data = talloc_zero(mem_ctx, struct readdir_attr_data);
-       if (*pattr_data == NULL) {
+       attr_data = talloc(mem_ctx, struct readdir_attr_data);
+       if (attr_data == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
-       attr_data = *pattr_data;
-       attr_data->type = RDATTR_AAPL;
+       *attr_data = (struct readdir_attr_data){.type = RDATTR_AAPL};
 
        /*
         * Mac metadata: compressed FinderInfo, resource fork length
@@ -4535,12 +4534,13 @@ static NTSTATUS fruit_freaddir_attr(struct vfs_handle_struct *handle,
                }
        }
 
+       *pattr_data = attr_data;
        return NT_STATUS_OK;
 
 fail:
        DBG_WARNING("Path [%s], error: %s\n", fsp_str_dbg(fsp),
                   nt_errstr(status));
-       TALLOC_FREE(*pattr_data);
+       TALLOC_FREE(attr_data);
        return status;
 }