diff options
Diffstat (limited to 'hw/9pfs/virtio-9p-xattr.c')
-rw-r--r-- | hw/9pfs/virtio-9p-xattr.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/9pfs/virtio-9p-xattr.c b/hw/9pfs/virtio-9p-xattr.c index 3fae557a84..07183887c5 100644 --- a/hw/9pfs/virtio-9p-xattr.c +++ b/hw/9pfs/virtio-9p-xattr.c @@ -67,21 +67,24 @@ ssize_t v9fs_list_xattr(FsContext *ctx, const char *path, void *value, size_t vsize) { ssize_t size = 0; - char buffer[PATH_MAX]; + char *buffer; void *ovalue = value; XattrOperations *xops; char *orig_value, *orig_value_start; ssize_t xattr_len, parsed_len = 0, attr_len; /* Get the actual len */ - xattr_len = llistxattr(rpath(ctx, path, buffer), value, 0); + buffer = rpath(ctx, path); + xattr_len = llistxattr(buffer, value, 0); if (xattr_len <= 0) { + g_free(buffer); return xattr_len; } /* Now fetch the xattr and find the actual size */ orig_value = g_malloc(xattr_len); - xattr_len = llistxattr(rpath(ctx, path, buffer), orig_value, xattr_len); + xattr_len = llistxattr(buffer, orig_value, xattr_len); + g_free(buffer); /* store the orig pointer */ orig_value_start = orig_value; |