diff options
Diffstat (limited to 'api/src/glfs-fops.c')
-rw-r--r-- | api/src/glfs-fops.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index 535dad3fea1..bc9c758a9c9 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -2568,11 +2568,14 @@ glfs_listxattr_process (void *value, size_t size, dict_t *xattr) { int ret = -1; - if (!value || !size || !xattr) + if (!xattr) goto out; ret = dict_keys_join (NULL, 0, xattr, NULL); + if (!value || !size) + goto out; + if (size < ret) { ret = -1; errno = ERANGE; @@ -2580,9 +2583,10 @@ glfs_listxattr_process (void *value, size_t size, dict_t *xattr) dict_keys_join (value, size, xattr, NULL); } - dict_unref (xattr); - out: + if (xattr) + dict_unref (xattr); + return ret; } |