summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/src/glfs-fops.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c
index 67d5616fe21..f27287b9d65 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -2543,23 +2543,23 @@ out:
int
glfs_listxattr_process (void *value, size_t size, dict_t *xattr)
{
- int ret = -1;
-
- ret = dict_keys_join (NULL, 0, xattr, NULL);
+ int ret = -1;
- if (!value || !size)
+ if (!value || !size || !xattr)
goto out;
+ ret = dict_keys_join (NULL, 0, xattr, NULL);
+
if (size < ret) {
ret = -1;
errno = ERANGE;
- goto out;
+ } else {
+ dict_keys_join (value, size, xattr, NULL);
}
- dict_keys_join (value, size, xattr, NULL);
+ dict_unref (xattr);
+
out:
- if (xattr)
- dict_unref (xattr);
return ret;
}